如何在Outlook中的選定郵件中獲取附件信息列表?
對於收到的帶有附件的電子郵件,有時您可能需要了解附件的詳細信息,例如顯示名稱,文件名等。 實際上,VBA代碼可以幫助您輕鬆地獲取Outlook當前選定電子郵件中的附件信息列表。 請瀏覽以下教程以了解更多詳細信息。
- 自動發送電子郵件 自動CC / BCC, 自動前進 按規則; 傳送 自動回复 (不在辦公室)無需交換伺服器...
- 取得類似提醒 BCC警告 當您在密件副本清單中回覆所有內容時,以及 缺少附件時提醒 對於忘記的附件...
- 提高電子郵件效率 回覆(全部)並附上附件, 自動添加問候語或日期和時間到簽名或主題中, 回覆多封電子郵件...
- 簡化電子郵件發送 撤回電子郵件, 附件工具 (壓縮全部、自動儲存全部...)、 刪除重複項和 快速報告...
在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特點 等待您的探索! 按此處了解更多。