Check for valid internal e-mail address

W

waxwing

I've created a small app that takes an Excel spreadsheet which is
output from our employee scheduling system and e-mails appropriate
chunks to individual employees. In most cases, the name coming out of
the scheduling system is the same name used in our Exchange global
address book. That be the case, I am able to pluck the name, i.e. Doe,
John, from the Excel sheet and send the worksheet to Doe, John.

In a few cases, the name on the sheet may not be the same as in the
scheduling system. Does anyone have a snipit of code that would allow
me to check a string against the address book to determine if it
exists?

Thanks.

- John

Using Outlook 2003 and automating via Excel VBA. Very new to Outlook
programming.
 
S

Sue Mosher [MVP-Outlook]

name = "Doe, John"

Set oOL = CreateObject("Outlook.Application")
Set recip = oOL.CreateRecipient(name)
If Not recip.Resolve Then
' name is not resolvable against the address book
ElseIf recip.AddressEntry.Type = "EX" Then
' name is an Exchange address book entry
End If

You could also use a Recipient object from a mail message, of course.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
W

waxwing

Thanks for the help Sue.

- John
name = "Doe, John"

Set oOL = CreateObject("Outlook.Application")
Set recip = oOL.CreateRecipient(name)
If Not recip.Resolve Then
' name is not resolvable against the address book
ElseIf recip.AddressEntry.Type = "EX" Then
' name is an Exchange address book entry
End If

You could also use a Recipient object from a mail message, of course.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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