附件保存到Outlook文件夹
问题描述:
我有很多我以前的电子邮件服务提供商的电子邮件,我已经转发给我的Outlook 2010收件箱文件夹Received
的。附件保存到Outlook文件夹
我的问题是原来的电子邮件已经被作为附件发送而不是作为一个前锋!所以我想要做的是:
- 公开赛在
Received
文件夹&运行VBA代码的邮件,将 - 提取从转发邮件的附件中
Received
文件夹和附件保存到Forwarded
文件夹 - 删除
Received
文件夹中的转发邮件。
我不了解Outlook VBA代码,所以我甚至没有一个起点!
任何asssistance将衷心感谢!
答
我用Outlook Attachment Remover Add-In删除附件,并将它们保存在文件系统中。我主要使用它来减少我的配置文件在服务器上需要的空间。 一件好事是该工具添加了一个链接到邮件的原始附件。所以你仍然可以打开附件文件,然后从文件系统打开。
答
使用我先前的代码VBA Code to save an attachment (excel file) from an Outlook email that was inside another email as an attachment这个展望VBA应该做的伎俩。
请确保
- 您的文件夹转发和收到收件箱下确实存在。
-
代码要求的目录
C:\temp\
来处理嵌入的电子邮件Sub SaveOlAttachments() Dim olFolder As MAPIFolder Dim olFolder2 As MAPIFolder Dim msg As MailItem Dim msg2 As MailItem Dim strFilePath As String Dim strTmpMsg As String 'path for creating attachment msg file for stripping strFilePath = "C:\temp\" strTmpMsg = "KillMe.msg" 'My testing done in Outlok using a "temp" folder underneath Inbox Set olFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox) Set olFolder2 = olFolder.Folders("Forwarded") Set olFolder = olFolder.Folders("Received") For Each msg In olFolder.Items If msg.Attachments.Count > 0 Then If Right$(msg.Attachments(1).FileName, 3) = "msg" Then msg.Attachments(1).SaveAsFile strFilePath & strTmpMsg Set msg2 = Application.CreateItemFromTemplate(strFilePath & strTmpMsg) End If msg.Delete msg2.Move olFolder2 End If Next End Sub