'這點代碼將會找到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.Count>0Then'?
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
郵箱:[email protected]
網址:http://www.geocities.com/SiliconValley/Haven/1768
->