View Single Post
  #1  
Old November 12th 06, 04:49 PM posted to microsoft.public.outlook.program_vba
Joel
external usenet poster
 
Posts: 48
Default Add Attachment to Item in Outbox

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 = " 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
Ads