|
-
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 ???
-
Jun 24th, 2001, 09:49 PM
#2
Frenzied Member
I just tested it and it works fine. Are you refrencing the outlook 9.0 library?
-
Jun 25th, 2001, 03:43 AM
#3
Yes I have.
Is it possible that it has something to do with the large number of
contacts that i have ?
-
Jun 25th, 2001, 03:49 AM
#4
Yes I have.
Is it possible that it has something to do with the large number of
contacts that i have ?
-
Jun 25th, 2001, 01:19 PM
#5
Frenzied Member
I only had ten contacts. Send the code to someone else that has as many contacts as you and see if it crashes.
-
Jun 30th, 2001, 09:41 PM
#6
New Member
Change "Next objEntry" to "Next" ;-)
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
|