Hi Ken,
I am having the same problem. I have downloaded and installed
Redemption, but I still can't seem to get this to work. Do you have idea
where my code is wrong? Thanks!
Public Sub CopyAttachment(myMailItem As Outlook.MailItem)
Dim NS As Outlook.NameSpace
Dim olkFolderset As Outlook.Folders
Dim olkFolder As Outlook.Folder
Dim olkAttachedMSG, olkMailItem, olkNewMailItem As Outlook.MailItem
Dim redAttachment, redMailItem As Object
Dim strID As String
strID = myMailItem.EntryID
Set NS = Outlook.GetNamespace("MAPI")
Set olkFolder = NS.OpenSharedFolder("ITCS (POP)\Inbox")
Set olkMailItem = NS.GetItemFromID(strID)
Set redMailItem = CreateObject("Redemption.SafeMailItem")
redMailItem.item = olkMailItem
Set redAttachment = redMailItem.Attachment
Set olkAttachedMSG = redAttachment.EmbeddedMsg
Set olkNewMailItem = Outlook.CreateItem(olMailItem)
olkAttachedMSG.CopyTo (olkNewMailItem)
olkNewMailItem.Save
olkNewMailItem.Move (olkFolder)
End Sub
"Ken Slovak - [MVP - Outlook]" wrote:
In general to work with any attachment you must save it to the file system
first. However, importing a MSG file from the file system or dealing with it
in any other way in code is not exposed in the Outlook object model. There's
a 3rd party library, Redemption (www.dimastr.com/redemption), that does let
you open and import MSG files into Outlook using code.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Bennett" wrote in message
...
I have a minor issue which is annoying. I have set up my work email to
forward to my Gmail account which I can access via POP in Outlook 2007.
My
emails are sent as attachments and I can't change this.
I have Vista Sideshow set up to view my Outlook emails but it won't
display
any attachments.
I can manually move (literally click and drag) the email attachment from
the
email to my inbox in Outlook and it appears as a separate email (woohoo!).
Great. But the whole point is not to have to do this manually. About
half
my emails are from this account, and most of the important ones are, so
this
would be nice to fix.
I've tried writing a VBA macro to do this, but it insists on treating the
email attachment as an attachment, which in fact it's really a MailItem.
The
software is clearly capable of dragging .msg files into the Outlook Inbox.
But how on earth do I tell Outlook to do that using VBA..? I kind of want
to
"save" the "attachment" but specifically save it into the Outlook Inbox,
NOT
a directory on the HDD.
Any ideas?