Using name from address book in lieu of actual email address

O

OssieMac

The following is an extract of code that I use to send emails from an Excel
program. How can I modify it to use peoples names as they appear in my
address book in lieu of using their actual email address for .To, .CC and .BCC

strTo = "(e-mail address removed)" 'Sample. Not valid email address
strCC = "(e-mail address removed)" 'Sample. Not valid email address
strBCC = "(e-mail address removed)" 'Sample. Not valid email address
Set objMail = objOutlook.CreateItem(olMailItem)

With objMail
.To = strTo
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strBody
.DeleteAfterSubmit = True 'Does not save email in Sent mail folder.
.Display
.Send
End With
 
M

Michael Bauer [MVP - Outlook]

Don't add email addresses but names, then call the ResolveAll function. If
the names can be resolved, you will see the DisplayNames. A name can be
resolved if there's exactly one e-mail address for the name.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 21 Dec 2009 22:44:01 -0800 schrieb OssieMac:
 
O

OssieMac

Thank you Michael. It is so easy. I just could not find the right word/s when
trying to look it up.

--
Regards,

OssieMac
 

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