【 tulaoshi.com - 编程语言 】
'这点代码将会找到Outlook信箱中的附件,并把它们保存至
'"C:empOutlookAttachments",它没有错误处理所以请小心使用!
'以下是代码(放在一个Command按钮下面)
DimoAppAsOutlook.Application
DimoNameSpaceAsNameSpace
DimoFolderAsMAPIFolder
DimoMailItemAsObject
DimsMessageAsString
SetoApp=NewOutlook.Application
SetoNameSpace=oApp.GetNamespace("MAPI")
SetoFolder=oNameSpace.GetDefaultFolder(olFolderInbox)
ForEachoMailItemInoFolder.Items
WithoMailItem
IfoMailItem.Attachments.Count0Then'?
oMailItem.Attachments.Item(1).SaveAsFile"C:TempOutlookAttachments"&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
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)->