跳到主要內容

如何在Outlook中的選定郵件中獲取附件信息列表?

對於收到的帶有附件的電子郵件,有時您可能需要了解附件的詳細信息,例如顯示名稱,文件名等。 實際上,VBA代碼可以幫助您輕鬆地獲取Outlook當前選定電子郵件中的附件信息列表。 請瀏覽以下教程以了解更多詳細信息。

在Outlook中獲取所選郵件中的附件信息列表

Office 標籤 - 在 Microsoft Office 中啟用選項卡式編輯和瀏覽,讓工作變得輕而易舉
Kutools for Outlook - 透過 100 多個進階功能增強 Outlook,實現卓越效率
使用這些進階功能增強您的 Outlook 2021 - 2010 或 Outlook 365。 享受全面的 60 天免費試用並提升您的電子郵件體驗!

箭頭藍色右氣泡在Outlook中獲取所選郵件中的附件信息列表

1.選擇要獲取附件信息的電子郵件。

2。 按 其他 + F11 鍵盤上的按鍵打開 Microsoft Visual Basic for Applications 窗口。

3.然後雙擊 Project1 > Microsoft Outlook對象 > 本次展望會議 打開 項目1 – ThisOutlookSession 窗口。 看截圖:

4.然後將下面的VBA代碼複製並粘貼到Project1 – ThisOutlookSession窗口中。

VBA代碼:獲取附件信息列表

Option Explicit
Public Sub GetAttachmentList()
    Dim selItem As Object
    Dim aMail As MailItem
    Dim aAttach As attachment
    Dim Report As String
    
    For Each selItem In Application.ActiveExplorer.Selection
        If selItem.Class = olMail Then
            Set aMail = selItem
            For Each aAttach In aMail.Attachments
                Report = Report & vbCrLf & "------------------------------------------------------------------------" & vbCrLf
                Report = Report & GetAttachmentInfo(aAttach)
            Next
            Call CreateReportEmail("Attachment Report", Report)
        End If
    Next
End Sub
 
Public Function GetAttachmentInfo(attachment As attachment)
    Dim Report
    GetAttachmentInfo = ""
    Report = Report & "Index: " & attachment.Index & vbCrLf
    Report = Report & "Display Name: " & attachment.DisplayName & vbCrLf
    Report = Report & "File Name: " & attachment.FileName & vbCrLf
    Report = Report & "Block Level: " & attachment.BlockLevel & vbCrLf
    Report = Report & "Path Name: " & attachment.PathName & vbCrLf
    Report = Report & "Position: " & attachment.Position & vbCrLf
    Report = Report & "Size: " & attachment.Size & vbCrLf
    Report = Report & "Type: " & attachment.Type & vbCrLf
    
    GetAttachmentInfo = Report
End Function
Sub CreateReportEmail(Title As String, Report As String)
    Dim aMail As MailItem
    
    Set aMail = Application.CreateItem(olMailItem)
        
    aMail.Subject = Title
    aMail.Body = Report
    
    aMail.Display
End Sub 

5。 按 F5 鍵盤上的鍵運行VBA代碼。

6.現在一個 彈出對話框,請點擊 按鈕。

7。 點擊後 按鈕在 對話框中,將創建一個新的消息窗口,其中在電子郵件正文內列出了所選電子郵件的所有附件信息。 看截圖:

備註:此VBA代碼可以應用於Outlook 2007、2010和2013


最佳辦公生產力工具

Kutools for Outlook - 超過 100 種強大的功能可增強您的 Outlook

🤖 人工智慧郵件助手: 具備人工智慧魔力的即時專業電子郵件——一鍵天才回覆、完美語調、多語言掌握。輕鬆改變電子郵件! ……

📧 電子郵件自動化: 外出(適用於 POP 和 IMAP)  /  安排發送電子郵件  /  發送電子郵件時按規則自動抄送/密件副本  /  自動轉送(進階規則)   /  自動添加問候語   /  自動將多收件者電子郵件拆分為單獨的訊息 ...

📨 電子郵件管理: 輕鬆回憶電子郵件  /  按主題和其他人阻止詐騙電子郵件  /  刪除重複的電子郵件  /  進階搜索  /  合併資料夾 ...

📁 附件專業版批量保存  /  批量分離  /  批量壓縮  /  自動保存   /  自動分離  /  自動壓縮 ...

🌟 介面魔法: 😊更多又漂亮又酷的表情符號   /  使用選項卡式視圖提高 Outlook 工作效率  /  最小化 Outlook 而不是關閉 ...

👍 一鍵奇蹟: 使用傳入附件回覆全部  /   反網路釣魚電子郵件  /  🕘顯示寄件者的時區 ...

👩🏼‍🤝‍👩🏻 通訊錄和行事曆: 從選定的電子郵件中大量新增聯絡人  /  將聯絡人群組拆分為各組  /  刪除生日提醒 ...

超過 100特點 等待您的探索! 按此處了解更多。

閱讀更多       免費下載      購買
 

 

Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi - I'm trying to figure out a way to set an automatic response which lists all the attachments they have sent. If this can include a file index for folders that would also be brilliant.


Basically - we receive emails with document submissions, I already have an automatic response set up to thank them for their submission but if this could now include "the documents you submitted are as below:... etc" that would help massively.


If somebody could help with this that would be brilliant! Thanks!
This comment was minimized by the moderator on the site
Hello. can you imagine any possibility to fetch/open a specific attachment directly from your list (e.g. a link embedded). Thank You in advance Sandra
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations