A
A Mad Doberman
I din't like the way my previous post sounded, so i'm reposting...
All,
My Excel VBA programming is decent enough when I'm only working with
Excel.
However, I'm trying to expand my knowledge base and frequently I wish
I could better interact with other Office programs, such as Outlook,
in my Excel VBA apps.
To better illustrate my question, here's a piece of code that works
great (it populates a user form list with Outlook addresses) but I
don't fully understand.
Private Sub UserForm_Activate()
Dim x As Integer
Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set myFolder = olNS.GetDefaultFolder(10)
Set myItems = myFolder.Items
myItems.Sort "FullName"
x = 0
For Each myContact In myItems
If TypeName(myContact) = "ContactItem" Then
If Len(myContact.Email1DisplayName) > 0 Then
ListBox1.AddItem
ListBox1.Column(0, x) = myContact.Email1DisplayName
ListBox1.Column(1, x) = myContact.Email1Address
x = x + 1
End If
End If
Next myContact
Set olNS = Nothing
Set objOL = Nothing
End Sub
My basic question is this: Can anyone suggest a good reference to
learn the uses and codes associated with objects, variables,
constants, etc..., which relate to programs outside Excel for use
within an Excel VBA app? For example, in the above code I do not
understand the precise usage of
GetNamespace("MAPI"), GetDefaultFolder(10), myFolder.Items,
Email1DisplayName, Email1Address, etc..., etc...
I don't like using code I don't understand for many obvious reasons.
Clearly, Email1DisplayName is a particular field in the OL Address
Book, but how do I learn what all of these fields are called? Where
do
I obtain syntax info for Outlook Object references? Etc.., Etc....I
think you'll all get what I'm asking.
Thanks, everyone!
All,
My Excel VBA programming is decent enough when I'm only working with
Excel.
However, I'm trying to expand my knowledge base and frequently I wish
I could better interact with other Office programs, such as Outlook,
in my Excel VBA apps.
To better illustrate my question, here's a piece of code that works
great (it populates a user form list with Outlook addresses) but I
don't fully understand.
Private Sub UserForm_Activate()
Dim x As Integer
Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set myFolder = olNS.GetDefaultFolder(10)
Set myItems = myFolder.Items
myItems.Sort "FullName"
x = 0
For Each myContact In myItems
If TypeName(myContact) = "ContactItem" Then
If Len(myContact.Email1DisplayName) > 0 Then
ListBox1.AddItem
ListBox1.Column(0, x) = myContact.Email1DisplayName
ListBox1.Column(1, x) = myContact.Email1Address
x = x + 1
End If
End If
Next myContact
Set olNS = Nothing
Set objOL = Nothing
End Sub
My basic question is this: Can anyone suggest a good reference to
learn the uses and codes associated with objects, variables,
constants, etc..., which relate to programs outside Excel for use
within an Excel VBA app? For example, in the above code I do not
understand the precise usage of
GetNamespace("MAPI"), GetDefaultFolder(10), myFolder.Items,
Email1DisplayName, Email1Address, etc..., etc...
I don't like using code I don't understand for many obvious reasons.
Clearly, Email1DisplayName is a particular field in the OL Address
Book, but how do I learn what all of these fields are called? Where
do
I obtain syntax info for Outlook Object references? Etc.., Etc....I
think you'll all get what I'm asking.
Thanks, everyone!