1)在“Inbox”裏面建立一個文件夾,命名爲 “For Download” ,把須要導出附件的Email郵件放在For Download裏面。ide
2)在D盤建立一個文件夾,命名爲“Email Attachment Temp” 。spa
3)打開outlook,按下Alt+F11 粘貼以下代碼:3d
Sub Savethep_w_upload() Dim olApp As New Outlook.Application Dim nmsName As Outlook.NameSpace Dim vItem As Object Set nmsName = olApp.GetNamespace("MAPI") Set myFolder = nmsName.GetDefaultFolder(olFolderInbox) Set fldFolder = myFolder.Folders("For Download") For Each vItem In fldFolder.Items '-----Save Attachment------- For Each att In vItem.Attachments att.SaveAsFile "D:\Email Attachment Temp\" & att.FileName Next '------Save Attachment-------- Next Set fldFolder = Nothing Set nmsName = Nothing End Sub
4)點擊“運行”。blog