1. 新建一個宏html
1)文件->選項->自定義功能區, 把主選項卡的 開發工具勾選上。安全
2)開發工具->宏,輸入宏名,建立。工具
加入如下代碼開發工具
Public Sub SaveAttach(Item As Outlook.MailItem) SaveAttachment Item, "D:\", "*.docx" End Sub ' 保存附件 ' path爲保存路徑,condition爲附件名匹配條件 Private Sub SaveAttachment(ByVal Item As Object, path$, Optional condition$ = "*") Dim olAtt As Attachment Dim i As Integer If Item.Attachments.Count > 0 Then For i = 1 To Item.Attachments.Count Set olAtt = Item.Attachments(i) ' save the attachment If olAtt.FileName Like condition Then olAtt.SaveAsFile path & olAtt.FileName End If Next End If Set olAtt = Nothing End Sub
3)點擊 宏安全性->宏設置->啓用全部宏,電子郵件安全性->勾選文件夾中的腳步下的兩個選項spa
2. 建立一個主題包含某些內容的規則,而後執行SaveAttach腳本。code
最後重啓outlook。htm
參考:http://zhiqiang.org/blog/it/auto-save-attachment-in-outlook.htmlblog