这点代码将会找到Outlook信箱中的附件,并把它们保存至
“C:\temp\OutlookAttachments”,它没有错误处理所以请小心使用!
以下是代码(放在一个Command按钮下面)
DimoAppAsOutlook.Application
DimoNameSpaceAsNameSpace
DimoFolderAsMAPIFolder
DimoMailItemAsObject
DimsMessageAsString
SetoApp=NewOutlook.Application
SetoNameSpace=oApp.GetNamespace(“MAPI”)
SetoFolder=oNameSpace.GetDefaultFolder(olFolderInbox)
ForEachoMailItemInoFolder.Items
WithoMailItem
IfoMailItem.Attachments.Count>0Then?
oMailItem.Attachments.Item(1).SaveAsFile”C:\Temp\OutlookAttachments\”&oMailItem.Attachments.Item(1).filename
MsgBoxoMailItem.Attachments.Item(1).DisplayName&”wassavedas”&oMailItem.Attachments.Item(1).filename
EndIf
EndWith
NextoMailItem
SetoMailItem=Nothing
SetoFolder=Nothing
SetoNameSpace=Nothing
SetoApp=Nothing
作者:LewisCornick
邮箱:l_cornick@hotmail.com
网址:http://www.geocities.com/SiliconValley/Haven/1768
->