How to list all attachment names into message body when composing email in Outlook?
Are there any good ways for us to insert all attachment names into message body when composing an email in Outlook? This article, I will talk about how to solve this job in Outlook.
List all attachment names into message body when composing email with VBA code
List all attachment names into message body when composing email with a simple feature
List all attachment names into message body when composing email with VBA code
Please do with the following steps to finish this task:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, double click ThisOutlookSession from the Project1(VbaProject.OTM) pane to open the mode, and then copy and paste the following code into the blank module.
VBA code: List all attachment names into message body:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim xMailItem As MailItem
If Item.Class = olMail Then
Set xMailItem = Item
If xMailItem.Attachments.Count > 0 Then
AddAttachmentNamesToBody
End If
End If
End Sub
3. Then go on clicking Insert > Module, copy and paste below code into the opened blank module, see screenshot:
VBA code: List all attachment names into message body:
Public Sub AddAttachmentNamesToBody()
Dim xMailItem As MailItem
Dim xAttachment As Attachment
Dim xFileName As String
Dim xInspector As Outlook.Inspector
Dim xDoc As Word.Document
Dim xWdSelection As Word.Selection
On Error Resume Next
Set xMailItem = Outlook.ActiveInspector.CurrentItem
If xMailItem.Attachments.Count = 0 Then
Exit Sub
End If
xFileName = ""
For Each xAttachment In xMailItem.Attachments
If xFileName = "" Then
xFileName = " <" & xAttachment.FileName & "> "
Else
xFileName = xFileName & vbCrLf & " <" & xAttachment.FileName & "> "
End If
Next xAttachment
Set xInspector = Outlook.Application.ActiveInspector()
Set xDoc = xInspector.WordEditor
Set xWdSelection = xDoc.Application.Selection
xWdSelection.HomeKey Unit:=wdStory
xWdSelection.InsertBefore "Attachments: " & vbCrLf & xFileName & vbCrLf & vbCrLf
Set xMailItem = Nothing
End Sub
4. And then click Tools > References in the Microsoft Visual Basic for Applications window, in the popped out References-Project1 dialog box, check Microsoft Word Object Library option from the Available References list box, see screenshot:
5. Click OK to exit the dialog box, then you should add the macro button into the Quick Access Toolbar. In the new Message window, choose More Commands from the Customize Quick Access Toolbar drop down, see screenshot:
6. In the Outlook Options dialog box, do the following operations:
(1.) Select Macros from the Choose commands from drop down list;
(2.) Click the macro name that you have inserted just now;
(3.) And then click Add button to add the macro into the Customize Quick Access Toolbar.
7. Then click OK to close the dialog box, now, the macro button has been inserted into the Quick Access Toolbar, see screenshot:
8. Now, when you create new message, and click the macro button, the attachment names will be inserted above the message body as following screenshot shown:
List all attachment names into message body when composing email with a simple feature
May be the above code is soemwhat difficult for you to apply, if you have Kutools for Outlook, with its Copy Names feature, you can quickly copy the attachment names of a message and paste them anywhere you need.
After installing Kutools for Outlook, please do as this:
1. First, please create the new email you need, and then click Kutools > Copy Names in the new Message window, see screenshot:
2. And then, a prompt box will pop out to remind you the attachment names have been copied to the clipboard, see screenshot:
3. Now, you just need to press Ctrl + V keys together to paste the attachment names to the message body you need, see screenshot:
More relative articles:
- Reply All With Original Attachments In Outlook
- Normally, when you apply the Reply All function to reply the message to all recipients in Outlook, the original attachments will be lost automatically. Is it possible to attach original attachments when reply to all in Outlook?
- Download/Save Attachments From Outlook To A Certain Folder
- Generally speaking, you can save all attachments of one email with clicking Attachments > Save All Attachments in Outlook. But, if you need to save all attachments from all received emails and receiving emails, any ideal? This article will introduce two solutions to automatically download attachments from Outlook to a certain folder.
- Change Default Attachment Saving Location In Outlook
- Have you fed up with finding the attachment location you have specified every time when launching Outlook? In this tutorial, we will show you how to change the default attachment location. After that, the specified attachment saving folder will be opened automatically every time you save the attachments even though you restarting the Outlook.
- Remove All Attachments From Email In Outlook
- Normally when you are previewing an email, you can delete an attachment with right clicking and select the Remove Attachment item. Sometimes there may be many attachments in an email message, and it will be tedious to remove them one by one. Here we arrange you with two easy tricks to remove all attachments in one email, and remove all attachments from multiple emails as well in Outlook.
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
📨 Email Management: Easily Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
📁 Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
🌟 Interface Magic: 😊More Pretty and Cool Emojis / Boost Your Outlook Productivity with Tabbed Views / Minimize Outlook Instead of Closing ...
👍 One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / 🕘Show Sender's Time Zone ...
👩🏼🤝👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.