⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 15.txt

📁 VB文章集(含API、窗口、数据库、多媒体、系统、文件、等等)
💻 TXT
字号:
把Outlook信箱中的附件另存为   
作者:Lewis Cornick
邮箱:l_cornick@hotmail.com
网址:http://www.geocities.com/SiliconValley/Haven/1768


'------------------------------------------------------
'Author: Lewis Cornick
'Date  : 04/22/98
'http://www.geocities.com/SiliconValley/Haven/1768
'E-Mail:l_cornick@hotmail.com

'Description: To be used in 'stripping' attachments from 
'e-mails in your inbox and save them to a hardcoded path.
'------------------------------------------------------
'This bit of code will strip attachments and save them into the path
'"C:\temp\Outlook Attachments", it has no error handling so be warned!
'Code starts (placed under a command button.)

'这点代码将会找到Outlook信箱中的附件,并把它们保存至
'"C:\temp\Outlook Attachments",它没有错误处理所以请小心使用!
'以下是代码(放在一个Command按钮下面)

Dim oApp As Outlook.Application
Dim oNameSpace As NameSpace
Dim oFolder As MAPIFolder
Dim oMailItem As Object
Dim sMessage As String

Set oApp = New Outlook.Application
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox)

  For Each oMailItem In oFolder.Items
    With oMailItem
      If oMailItem.Attachments.Count > 0 Then '?
        oMailItem.Attachments.Item(1).SaveAsFile "C:\Temp\Outlook
Attachments\" & oMailItem.Attachments.Item(1).filename
        MsgBox oMailItem.Attachments.Item(1).DisplayName & " was
saved as " & oMailItem.Attachments.Item(1).filename
      End If
    End With
  Next oMailItem

Set oMailItem = Nothing
Set oFolder = Nothing
Set oNameSpace = Nothing
Set oApp = Nothing
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -