Come elencare tutti i nomi degli allegati nel corpo del messaggio durante la composizione della posta elettronica in Outlook?
Esistono buoni modi per inserire tutti i nomi degli allegati nel corpo del messaggio durante la composizione di un'e-mail in Outlook? In questo articolo, parlerò di come risolvere questo lavoro in Outlook.
Elenca tutti i nomi degli allegati nel corpo del messaggio durante la composizione di e-mail con codice VBA
Si prega di eseguire i seguenti passaggi per completare questa attività:
1. Tieni premuto il ALT + F11 chiavi per aprire il Microsoft Visual Basic, Applications Edition finestra.
2. Nel Microsoft Visual Basic, Applications Edition finestra, fare doppio clic Questa sessione di Outlook dal Progetto1 (VbaProject.OTM) riquadro per aprire la modalità, quindi copia e incolla il codice seguente nel modulo vuoto.
Codice VBA: elenca tutti i nomi degli allegati nel corpo del messaggio:
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:
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.
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
- BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
- Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
- Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
- Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
Comments (12)There are no comments posted here yetLeave your comments