Checking Outlook Email Address
JP,
Many thanks for you help, your comments prompted to look in the Outlook
forum and I found a few hints and just tested by revised code (which is
essentially what you said below).
If EDisplayorSend = "Send" Then
If .Recipients.ResolveAll Then
.Send
Else
.Display
End If
Else
.Display
End If
--
Trefor
"JP" wrote:
In your code, you have to set an object reference to the Recipients
collection, because ResolveAll is a method of the Recipients
collection. So your code would be
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim myRecipients As Outlook.Recipients
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = ETo
.CC = Ecc
.BCC = EBcc
.Subject = ESubject
.Body = Emsg
If EDisplayorSend = "Display" Then
.Display
Exit Sub
If EDisplayorSend = "Send" Then
Set myRecipients = .Recipients
If Not myRecipients.ResolveAll Then
.Display
Else
.Send
End If
End If
End With
Set myRecipients = Nothing
Set OutMail = Nothing
Set OutApp = Nothing
Just curious, why not try to change the inputs -- can you get the list
of email addresses instead of the names?
Is there any other way you can get a list of the email addresses?
Maybe you can export the contact information (name and email address)
from Outlook, then use VLOOKUP or a fuzzy match to match them to the
names from your list.
Where does the table come from that the names are written so
differently than what they are in Outlook?
--JP
On Sep 18, 7:44 am, Trefor wrote:
JP,
Yes I understand if I construct the full email address I won't need to
resolve them. Problem is I don't have the full email address and for some
reason our names are full names including the middle name and to make it
worse shortened name so:
"Jones, Rodney John"
Might be:
"Jones, Rod" as a resolved name
or
|