我尝试运行此代码,但它不会将xml文件保存到给定的文件夹中。这有什么问题?
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat As String
dateFormat = Format(Now, "yyyy-mm-dd H-mm")
saveFolder = "C:\Users\gabor\Documents\CAFM\xml\"
For Each objAtt In itm.Attachments
If InStr(objAtt.DisplayName, ".xml") Then
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
End If
Set objAtt = Nothing
Next
End Sub
答案 0 :(得分:0)
来自评论"更改安全设置解决了问题。我必须设置宏设置才能启用所有宏。" - vergab 7月28日20:09