我使用Outlook Rule函数来确定我从这个"X"收到的所有邮件。电子邮件地址和规则设置的方式是,当找到规则标准时,它将运行一个VBA脚本(参见下面的VBA脚本)。
我与这个VBA脚本的问题是,只有最后的电子邮件附件得到保存从"X"用户。这意味着规则将适用于所有的电子邮件,然而VBA代码-这是为了保存每封电子邮件的附件-只保存最后一封电子邮件的附件。
'''
Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "L:my file path I save the PDFs to"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & "Signature -" & i & ".pdf" 'oAttachment.DisplayName
Set oAttachment = Nothing
Next
End Sub
'''
我甚至尝试重命名PDF,使VBA没有重新保存相同的名称在以前的PDF顶部的问题,但这没有帮助-问题仍然存在,只有最后的电子邮件附件得到保存。请帮忙:)
'''
Public Sub saveAttachtoDisk2(itm As Outlook.MailItem)
Dim objtest As Outlook.Application
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim x As Integer
saveFolder = "L:L:my file path I save the PDFs to"
x = 1
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "Signature - " & x '& objAtt.DisplayName
Set objAtt = Nothing
x = x + 1
Next
End Sub
'''
dim i as long
i = i+1 in your loop