I guess I should have mentioned that if you are only having trouble
with specific email addresses, just convert them to
(E-Mail Removed)
instead of trying to use the Addressbook name. This happens to me when
someone in my Addressbook has a fax number and email address, Outlook
doesn't know which one to use, so the email cannot be sent.
If the display name is "John Smith" and the email address is
"(E-Mail Removed)", just replace the name with the email address
and it should resolve every time.
If that's not possible, there is some sample code in the Outlook VBIDE
if you type "ResolveAll" and press F1. I modified it slightly to work
in Excel. Keep in mind that those code will trigger the Outlook
security prompt, since you are accessing the Recipients collection.
Sub CheckRecipients()
Dim myOlApp As Object
Dim MyItem As Object
Dim myRecipients As Object
Dim myRecipient As Object
Dim ThisRecip As Object
Dim i As Long
Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItem(0)
'MyItem.Display
Set myRecipients = MyItem.Recipients
myRecipients.Add ("Aaron Con")
myRecipients.Add ("Nate Sun")
myRecipients.Add ("Dan Wilson")
If Not myRecipients.ResolveAll Then
For i = myRecipients.Count To 1 Step -1
If Not myRecipients.Item(i).Resolved Then
myRecipients.Remove (i)
End If
Next i
End If
End Sub
This code checks if all the names are resolved, and if not, it steps
through the Recipients collection and removes the ones that aren't
resolved. If you wanted to do something else with the names (i.e.
build a string of names of people who weren't resolved), write back
and we can work on that.
--JP
On Sep 16, 1:18*pm, Trefor <Tre...@home.com> wrote:
> JP,
>
> Sounds good. Where I can get more info on this? I tried help on a few key
> words on your post, but could not find out any more details. Do you have a
> reference or sample code?
>
> --
> Trefor
>
>
>
> "JP" wrote:
> > The Resolved Property of the Recipient Object returns True/False
> > depending on whether the recipient name has been resolved. Also the
> > Resolve Method does the same thing. You can loop through the
> > Recipients Collection and run the Resolve method on each one. If
> > False, you can remove them from the Recipient list, build a string
> > showing which recipients were removed, etc.
>
> > --JP
>