A
Alex K
The code below works with Outlook 2007, but fails with Outlook 2010 RTM. The
"objAttachments.Add" line throws the following error:
---------------------------
Run-time error '-2147221233 (8004010f)':
The attempted operation failed. An object could not be found.
---------------------------
Any ideas on a workaround?
Sub AddAttachment()
Dim objItem As Outlook.MailItem
Dim objAttachments As Outlook.Attachments
Dim objItemAtt As Outlook.MailItem
Set objItem = Application.CreateItem(olMailItem)
Set objItemAtt = Application.ActiveExplorer.Selection.Item(1)
Set objAttachments = objItem.Attachments
objAttachments.Add objItemAtt, Outlook.olEmbeddeditem, 1, "foo"
objItem.Display
End Sub
Thank you in advance,
ak
"objAttachments.Add" line throws the following error:
---------------------------
Run-time error '-2147221233 (8004010f)':
The attempted operation failed. An object could not be found.
---------------------------
Any ideas on a workaround?
Sub AddAttachment()
Dim objItem As Outlook.MailItem
Dim objAttachments As Outlook.Attachments
Dim objItemAtt As Outlook.MailItem
Set objItem = Application.CreateItem(olMailItem)
Set objItemAtt = Application.ActiveExplorer.Selection.Item(1)
Set objAttachments = objItem.Attachments
objAttachments.Add objItemAtt, Outlook.olEmbeddeditem, 1, "foo"
objItem.Display
End Sub
Thank you in advance,
ak