J
Joel
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 = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\115.xls")
objItem.Send
End If
If objItem.To = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\116.xls")
objItem.Send
End If
If objItem.To = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\117.xls")
objItem.Send
End If
Next
End Sub
Thanks again, Joel
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 = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\115.xls")
objItem.Send
End If
If objItem.To = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\116.xls")
objItem.Send
End If
If objItem.To = "'(e-mail address removed)'" Then
objItem.Attachments.Add ("C:\117.xls")
objItem.Send
End If
Next
End Sub
Thanks again, Joel