Checking address resolution in vbscript

  • Thread starter Thread starter Long Nguyen
  • Start date Start date
L

Long Nguyen

(Outlook 2000)

Good day,
I have custom form which includes the vbscript code below that checks if
address resolution for NewMail mail item was successful:

NewMail.Recipients.ResolveAll
For Each objRecipient in NewMail.Recipients
If objRecipient.Resolved = False Then
msgbox "Invalid address: " & objRecipient.Name
End If
Next

(This code is copied from Hour 16 in Sue Mosher's Outlook 2000 Programming
book)

However I found that if one of the addresses in Newmail.Recipients invalid,
then the For loop would display out ALL recipients (i.e. the
objectRecipient.Resolved would return False for all recipients). If all
addresses are valid then no recipient names are displayed.

Could you explain to me why.

Thanks
Long.
 
Hi,

I would appreciate if someone gives me ideas on this problem. I have been
searching for info and haven't got much. Many thanks.

Long.
 
NewMail.Recipients.ResolveAll
For Each objRecipient in NewMail.Recipients
If objRecipient.Resolved = False Then
msgbox "Invalid address: " & objRecipient.Name
End If
Next
If it were me, I would set objRecipient to nothing just before the next
statement. Or perhaps set ThisRecipient = objRecipient before the If
statement, test on ThisRecipient and set it to nothing just before the
Next statement.

Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access 4.52 build 277 (32-bit), Windows 2000 build 2195
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US

Mukilteo, WA USA
 
Thanks Paul for the suggestion.

What I found (by trial and errors) was that if I go through each recipient
in the recipienets colection and use the Resolve (not Resolved) method then
it works.

Regards
Long


Hollis D. Paul said:
NewMail.Recipients.ResolveAll
For Each objRecipient in NewMail.Recipients
If objRecipient.Resolved = False Then
msgbox "Invalid address: " & objRecipient.Name
End If
Next
If it were me, I would set objRecipient to nothing just before the next
statement. Or perhaps set ThisRecipient = objRecipient before the If
statement, test on ThisRecipient and set it to nothing just before the
Next statement.

Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access 4.52 build 277 (32-bit), Windows 2000 build 2195
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US

Mukilteo, WA USA
 
Back
Top