|
-
Jun 24th, 2001, 07:19 AM
#1
What's wrong with this ?
I have a small piece of code in which I just try to retrieve the names of all Outlook contacts and put them in a listbox.
This gives me a runtime error '13': Type mismatch at the last line of code (Next objEntry):
Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objContacts As MAPIFolder
Dim objEntry As ContactItem
'Get the MAPI reference
Set objNameSpace = objOutlook.GetNamespace("MAPI")
'Pick up the Contacts
Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)
'Loop through the folders under the Inbox
For Each objEntry In objContacts.Items
lstfolders.AddItem objEntry.LastName
Next objEntry
Any idea's ???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|