![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am trying to use VBA in Outlook to copy an attached msg file in an email to
a folder and then delete the original email. I am currently working to just get the attached msg file to move to the proper folder. I have downloaded and installed Redemption in order to do this as suggested on other boards. I thought my code was close to what other people have (modified for my use), but it doesn’t seem to work. Please let me know what I need to change for this. Thank you. 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 |
Ads |
#2
|
|||
|
|||
![]()
What exactly does not work?
Do you get an error? Or it simply produces an unexpected result? -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Aaron" wrote in message ... I am trying to use VBA in Outlook to copy an attached msg file in an email to a folder and then delete the original email. I am currently working to just get the attached msg file to move to the proper folder. I have downloaded and installed Redemption in order to do this as suggested on other boards. I thought my code was close to what other people have (modified for my use), but it doesn't seem to work. Please let me know what I need to change for this. Thank you. 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
copy/cut and/or paste attachments | marieh | Outlook - Installation | 3 | October 31st 08 11:04 AM |
Copy Inbox | Alven | Outlook - General Queries | 2 | July 7th 07 11:23 AM |
Redemption Inbox problem + instability | mirzoni | Outlook and VBA | 9 | December 8th 06 04:51 PM |
Useing Redemption Object to Read an Inbox | Damian | Add-ins for Outlook | 9 | June 8th 06 06:57 AM |
cannot copy & paste attachments | David Grana | Outlook - Installation | 0 | March 22nd 06 06:01 PM |