Add Attachment to Item in Outbox

J

Joel

I have following code to add attachment to selected items in outbox. I would
like to add code to test the TO: value and attach a specifice email based on
value.


Sub AddAttachmentToSelectedMessages()
Dim objItem As MailItem
If ActiveExplorer.Selection.Count = 0 Then Exit Sub

For Each objItem In ActiveExplorer.Selection
objItem.Attachments.Add ("C:\ap.xls")
objItem.Save
Next
End Sub

I tried to add line such as:

If objItem.To = "(e-mail address removed)" then
objItem.Attachments.Add ("C:\bob.xls") ... but it didn't work.

Any ideas to identify the TO value of teh email in the outbox??

Thanks,

Joel
 
M

Michael Bauer [MVP - Outlook]

It's better to read the addresses from each item's Recipients collection
instead.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

Am Sun, 12 Nov 2006 07:49:02 -0800 schrieb Joel:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top