跳到主要内容

如何在Outlook中的选定邮件中获取附件信息列表?

添加一名作者 最后修改时间:2014-09-25

对于收到的带有附件的电子邮件,有时您可能需要知道附件的详细信息,例如显示名称,文件名等。 实际上,VBA代码可以帮助您轻松获取Outlook当前选定电子邮件中的附件信息列表。 请浏览以下教程以了解更多详细信息。

在Outlook中获取所选邮件中的附件信息列表

Office 选项卡 - 在 Microsoft Office 中启用选项卡式编辑和浏览,让工作变得轻而易举
解锁 Outlook 的 Kutools 免费 版本 立即享受超过 70 项功能,永久无限制访问
使用这些高级功能增强您的 Outlook 2021 - 2010 或 Outlook 365。享受 70 多种强大功能并提升您的电子邮件体验!

箭头蓝色右气泡在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 发布 免费版本!

体验全新的 Kutools for Outlook 免费版本拥有 70 多项令人难以置信的功能,您可以永久使用! 点击立即下载!

🤖 Kutools人工智能 : 具有人工智能魔力的即时专业电子邮件——一键天才回复、完美语气、多语言掌握。轻松改变电子邮件! ...

📧 电子邮件自动化: 自动回复(适用于 POP 和 IMAP)  /  安排发送电子邮件  /  发送电子邮件时按规则自动抄送/密件抄送  /  自动转发(高级规则)   /  自动添加问候语   /  自动将多收件人电子邮件拆分为单独的消息 ...

📨 电子邮件管理: 撤回电子邮件  /  按主题和其他人阻止诈骗电子邮件  /  删除重复的电子邮件  /  高级搜索  /  合并文件夹 ...

📁 附件专业版批量保存  /  批量分离  /  批量压缩  /  自动保存   /  自动分离  /  自动压缩 ...

🌟 界面魔法: 😊更多又漂亮又酷的表情符号   /  收到重要邮件时提醒您  /  最小化 Outlook 而不是关闭 ...

👍 一键奇迹: 使用传入附件回复全部  /   反网络钓鱼电子邮件  /  🕘显示发件人的时区 ...

👩🏼‍🤝‍👩🏻 通讯录和日历: 从选定的电子邮件中批量添加联系人  /  将联系人组拆分为各个组  /  删除生日提醒 ...

只需单击一下即可立即解锁 Kutools for Outlook -永久免费. 别等了, 立即下载并提高您的效率!

kutools for outlook 功能1 kutools for outlook 功能2
 

 

 

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
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations