这是我到目前为止所做的:
Public Sub saveAttachtoDisk6(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "P:\me\"
Dim dateFormat
dateFormat = Format(Now, "yyyy.mm.dd")
For Each objAtt In itm.Attachments
If InStr(1, objAtt.FileName, "ASDFA", vbTextCompare) > 0 Then
objAtt.SaveAsFile saveFolder & dateFormat & " ADFA ADF.pdf"
ElseIf InStr(1, itm.Subject, "ASDF ADSF ADSF", vbTextCompare) > 0 Then
objAtt.SaveAsFile saveFolder & dateFormat & " ASD ASDF ASD.pdf"
ElseIf InStr(1, objAtt.FileName, "ASDDAAD", vbTextCompare) > 0 Then
objAtt.SaveAsFile saveFolder & dateFormat & " ASDF ADF AD.pdf"
Else
End If
Set objAtt = Nothing
Next
End Sub
为隐私更改了文件名,但我想将日期放在文件名之后,但我需要.pdf将文件保存为pdf' s。我得到的文件是电子邮件中的pdf,但出于某种原因,我只能通过在文件名末尾添加.pdf来实现这一点。有没有什么方法可以将其保存为" ASDD ASDAS 2016.05.11.pdf"而不是" 2016.05.11 ADSF ASDF.pdf"?
感谢!!!
答案 0 :(得分:1)
这应该有效: objAtt.SaveAsFile saveFolder& “ASDF ADF AD”& dateFormat& “.PDF”