Returning Outlook email addresses

G

GeorgeFD29

I have the following code working - talking to outlook. However, whenever I
try to return the email address of the contact, I get 'object doesn't support
this property or method' thanks for any help.

Dim OLF As Outlook.MAPIFolder
Dim olContactItem As Outlook.ContactItem
Dim ToContact As Recipient
Set OLF = GetObject("",
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)

Set itms = OLF.Items

For i = 1 To itms.Count
Set itm = itms(i)
strContactName = itm.LastName & ", " & itm.FirstName & " " & itm.MiddleName
strEmail = itm.email
Next
 
T

Tom Ogilvy

change
strEmail = itm.email

to

strEmail = itm.email1address

would be my guess, but this is an excel group and an outlook group would
probably be more helpful.
 
D

David

I say your code, and tried to use it, but I'm getting a compile error on the
first line of DIM code for the MAPI folder. What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top