![]() |
| 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. |
|
|||||||
| Tags: automatically, messages, outbox, send |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
TIA:
Trying to send email after adding attachments in Outbox...the following code producess error "item has been moved or deleted". If I just Save the emails, all is OK but they will not be sent when I click " Send and Receive" after attaching files through code. What do I need to do in code to have the emails Sent in Outbox so that when I click " Send and Receive" they will go... Thanks, Joel Sub AddAttachmentToSelectedMessages() Dim oFolder As Outlook.MAPIFolder Dim items As Outlook.items Dim objItem As MailItem Set items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).items For Each objItem In items If objItem.To = '" Then objItem.Attachments.Add ("C:\115.xls") objItem.Send End If If objItem.To = '" Then objItem.Attachments.Add ("C:\116.xls") objItem.Send End If If objItem.To = '" Then objItem.Attachments.Add ("C:\117.xls") objItem.Send End If Next End Sub Thanks again, Joel |
| Ads |
|
#2
|
|||
|
|||
|
Hello All:
Realized bad code structu Used If Elseif and all is OK, Joel "Joel" wrote: TIA: Trying to send email after adding attachments in Outbox...the following code producess error "item has been moved or deleted". If I just Save the emails, all is OK but they will not be sent when I click " Send and Receive" after attaching files through code. What do I need to do in code to have the emails Sent in Outbox so that when I click " Send and Receive" they will go... Thanks, Joel Sub AddAttachmentToSelectedMessages() Dim oFolder As Outlook.MAPIFolder Dim items As Outlook.items Dim objItem As MailItem Set items = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).items For Each objItem In items If objItem.To = '" Then objItem.Attachments.Add ("C:\115.xls") objItem.Send End If If objItem.To = '" Then objItem.Attachments.Add ("C:\116.xls") objItem.Send End If If objItem.To = '" Then objItem.Attachments.Add ("C:\117.xls") objItem.Send End If Next End Sub Thanks again, Joel |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to make Outlook send Outbox email automatically | ebizsupp | Outlook - Installation | 1 | October 28th 06 01:00 AM |
| send messages are sitting in outbox. How can I get them to leave | blobby | Outlook - General Queries | 2 | October 27th 06 04:00 AM |
| I can't send my messages. They end up in the outbox. | moi | Outlook - General Queries | 0 | October 15th 06 02:54 PM |
| I can't send messages. They stay in my outbox. Why? | jbriggs | Outlook - General Queries | 3 | October 2nd 06 05:16 AM |
| cannot send messages from outbox | spatel | Outlook - General Queries | 8 | May 14th 06 11:34 PM |