保存本地outlook中的所有邮件

Sub SaveAttachment()
Dim objCurrentItem As Outlook.MailItem
Dim colAttachments As Outlook.Attachments
Dim objAttachment As Outlook.Attachment

Set objCurrentItem = Application.ActiveInspector.CurrentItem
Set colAttachments = objCurrentItem.Attachments
Set strFolderpath = CreateObject("WScript.Shell")

For Each objAttachment In colAttachments
  objAttachment.SaveAsFile (strFolderpath.SpecialFolders("MyDocuments") & "\" & objAttachment.FileName)
Next

Set objAttachment = Nothing
Set colAttachments = Nothing
objCurrentItem.Close (olDiscard)
Set objCurrentItem = Nothing

End Sub

posted on 2006-09-21 09:48  hades  阅读(1113)  评论(0)    收藏  举报

导航