跳到主要内容

如何在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应用程序 窗口。

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