• Subject: Attaching mail items in Outlook 2010
  • Author: Alex K
  • Date: 03 May 2010
  • References:
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
03 May 2010Attaching mail items in Outlook 2010.Alex K
04 May 2010\ Re: Attaching mail items in Outlook 2010.Ken Slovak - [MVP - O...
04 May 2010   \ Re: Attaching mail items in Outlook 2010.Alex K
04 May 2010      \ Re: Attaching mail items in Outlook 2010.Ken Slovak - [MVP - O...
05 May 2010         \ Re: Attaching mail items in Outlook 2010.Ken Slovak - [MVP - O...
05 May 2010            \ Re: Attaching mail items in Outlook 2010.Ken Slovak - [MVP - O...
22 Oct 2010               \ Re: In further testing both by me and by the Outlook product group, itappears....Charlie Hall
25 Oct 2010                  \ Re: In further testing both by me and by the Outlook product group, it appear....Ken Slovak
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)