Check for valid internal e-mail address

  • Thread starter Thread starter waxwing
  • Start date Start date
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.
 
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
 
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
 
Back
Top