![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]() 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: 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
can't add calendar item | lauriedee64 | Outlook - Calandaring | 0 | September 12th 06 07:55 PM |
Help - can't add "Item" (of type MailItem) using Attachments.Add() | [email protected] | Outlook and VBA | 1 | August 3rd 06 06:55 AM |
Sending custom form item as mail attachment to person outside org | DougMunday | Outlook - Using Forms | 4 | April 13th 06 09:02 PM |
Email message with attachment stuck in Outbox | Robin Lund | Outlook - General Queries | 2 | February 28th 06 02:48 AM |
Accidental 65mb attachment locks up outbox | Corky D | Outlook - General Queries | 2 | January 26th 06 07:22 PM |