Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Check Names Problem

Status
Not open for further replies.

laurenbattaglia

Technical User
May 3, 2002
28
US
I am trying to write vb to send several different mail messages with attachments. The issue I am running into, is if one of the recipients is taken out of the address book, then the code bombs when it hits that name. Is there a way to error check the names before sending out proceeding to creating and sending the emails? The following is what I have so far, but this is my first time writing VB for outlook. Thanks for the help.

Sub SendMyMail
Set myItemss = Outlook.CreateItem(olMailItem)
myItemss.To = "Jones, Dan"
myItemss.Subject = "Sales and Services PTO"
Set myAttachments = myItemss.Attachments
myAttachments.Add "\\PTO Reports\PTO Process\Sales and Services PTO.xls", _
olByValue, 1, "Sales and Services PTO"


Set myIteme = Outlook.CreateItem(olMailItem)
myIteme.To = "Battaglia, Lauren"
myIteme.Subject = "Operations and Engineering PTO"
Set myAttachments = myIteme.Attachments
myAttachments.Add "\\PTO Reports\PTO Process\Operations and Engineering PTO.xls", _
olByValue, 1, "Operations and Engineering PTO"
myItemss.Send
myIteme.Send

End Sub

 
You may consider the Recipient object and the Resolve method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top