Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to get list of attachments' information in selected mail in Outlook?

For the received emails which attached with attachments, sometimes you may need to know the detailed information of the attachments, such as the display name, file name and so on. Actually, VBA code can help you easily get the list of attachments’ information in current selected email in Outlook. Please browse the below tutorial for more details.

Get list of attachments’ information in selected mail in Outlook

Kutools for Outlook: 100+ New Advanced Tools for Outlook.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu: Bring Old Menus and Toolbars Back to Office 2007, 2010, 2013, 2016 and 2019.

arrow blue right bubbleGet list of attachments’ information in selected mail in Outlook

1. Select the email with attachments which you want to get the information of them.

2. Press the Alt + F11 keys on the keyboard to open the Microsoft Visual Basic for Applications window.

3. Then double click the Project1 > Microsoft Outlook Object > ThisOutlookSession to open the Project1 – ThisOutlookSession window. See screenshot:

4. Then copy and paste the below VBA code into the Project1 – ThisOutlookSession window.

VBA code: get list of attachments’ information

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. Press F5 key on the keyboard to run the VBA code.

6. Now a Macros dialog box pops up, please click the Run button.

7. After clicking the Run button in the Macros dialog box, a new message window will be created with all attachments information of selected email listed inside the email body. See screenshot:

Note: This VBA code can be applied to Outlook 2007, 2010 and 2013

 

Recommended Productivity Tools

shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121

Kutools for Outlook - More than 100 Advanced Functions for Outlook, Improve 70% Efficiency For you

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Forward multiple emails individually with one-click, and auto forward by rules.
  • Auto CC/BCC every sending email and easy for customizing rules, and auto reply without requiring exchange server.
  • Powerful junk emails filter, remove duplicate emails, reply with attachment, bunch of one-click operations, and so on...
  • 60-day unlimited free trial. 60-day money back guarantee. 2 years free upgrade and support. Buy once, use forever.
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Courtney Halstead · 1 years ago
    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!
  • To post as a guest, your comment is unpublished.
    Sandra.H.H · 3 years ago
    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