G
Guest
Hi, I posted a question about this in Word programming forum but so far no
response.
I am writing a tool for Word 2002, which includes a userform with a listbox
containing the names of all staff. The names are in everyone's Outlook
Address Book (global) (using Outlook 2002) so it makes sense to get the names
from there.
Here's the code I am using in my Word userform. I admit I am new to this and
do not understand all of the code. It crashes where shown and causes Outlook
to close in the process. I am keen to learn, so any advice will be very
welcome.
Set oNamespc = oApp.GetNamespace("MAPI")
For Each oItm In oNamespc.GetDefaultFolder(olFolderContacts).Items '<--
crashes here
With ListBox1
..AddItem (oItm.FullName)
End With
Next oItm
-
Stephenc
response.
I am writing a tool for Word 2002, which includes a userform with a listbox
containing the names of all staff. The names are in everyone's Outlook
Address Book (global) (using Outlook 2002) so it makes sense to get the names
from there.
Here's the code I am using in my Word userform. I admit I am new to this and
do not understand all of the code. It crashes where shown and causes Outlook
to close in the process. I am keen to learn, so any advice will be very
welcome.
Set oNamespc = oApp.GetNamespace("MAPI")
For Each oItm In oNamespc.GetDefaultFolder(olFolderContacts).Items '<--
crashes here
With ListBox1
..AddItem (oItm.FullName)
End With
Next oItm
-
Stephenc