Note: The other languages of the website are Google-translated. Back to English

Come inserire tutti i nomi dei destinatari nel corpo dell'email in Outlook?

A volte, potrebbe essere necessario inserire i nomi di tutti i destinatari nel corpo del messaggio durante la composizione di un'e-mail in Outlook. Ovviamente puoi copiare e incollare i nomi nel corpo uno per uno. Ma è molto noioso se ci sono dozzine di nomi di destinatari che devono essere incollati. In questo articolo, parlerò di un modo semplice per risolvere questo lavoro in Outlook.

Inserisci tutti i nomi dei destinatari nel corpo dell'email con il codice VBA in Outlook

Inserisci tutti i nomi dei destinatari nel corpo dell'email con il codice VBA in Outlook

Il seguente codice VBA può aiutarti a inserire tutti i nomi dei destinatari dal campo A nel corpo del messaggio, per favore fai come segue:

1. Avvia Outlook, quindi tieni premuto il pulsante ALT + F11 chiavi per aprire il Microsoft Visual Basic, Applications Edition finestra.

2. Clic inserire > Moduloe incolla il codice seguente nel file Modulo Finestra.

Codice VBA: inserisci i nomi dei destinatari nel corpo del messaggio:

Sub InsertRecipientNamesToBody()
Dim xMailItem As Outlook.MailItem
Dim xRecipient As Outlook.Recipient
Dim xRecipAddress, xRecipNames, xRecipName, xFilterAddr As String
Dim xItems As Outlook.Items
Dim i As Integer
Dim xFoundContact As Outlook.ContactItem
Dim xDoc As Word.Document
On Error Resume Next
Set xMailItem = Outlook.ActiveInspector.CurrentItem
For Each xRecipient In xMailItem.Recipients
    xRecipAddress = xRecipient.Address
    Set xItems = Application.Session.GetDefaultFolder(olFolderContacts).Items
    For i = 1 To 3
        xFilterAddr = "[Email" & i & "Address] = " & xRecipAddress
        Set xFoundContact = xItems.Find(xFilterAddr)
        If Not (xFoundContact Is Nothing) Then
           xRecipNames = xRecipNames & xFoundContact.FullName & Chr(10)
           Exit For
        End If
    If (xFoundContact Is Nothing) Then
       xRecipName = Split(xRecipAddress, "@")(0)
       xRecipNames = xRecipNames & xRecipName & Chr(10)
    End If
Set xDoc = xMailItem.GetInspector.WordEditor
xDoc.Content.InsertAfter xRecipNames
Set xMailItem = Nothing
Set xRecipient = Nothing
Set xItems = Nothing
Set xFoundContact = Nothing
End Sub

3. And then still in the Microsoft Visual Basic for Applications window, click Tools > References to go to the References-Project1 dialog box, and check Microsoft Word Object Library option from the Available References list box, see screenshot:

4. Then click OK to close the dialog, now, you should add this code to the Quick Access Toolbar.

5. Create a new message by clicking New Email, in the Message window, click Customize Quick Access Toolbar icon, and select More Commands, see screenshot:

6. In the Outlook Options dialog box:

(1.) Select Macros from the Choose commands from drop down list;

(2.) And then choose the VBA code name which you have inserted just now;

(3.) Click Add button to add the code into the Customize Quick Access Toolbar list box.

7. And then a macro icon is displayed into the Quick Access Toolbar as following screenshot shown:

8. Now, when you click the macro icon, the recipient names from the To field will be inserted into the message body as following screenshot shown:

Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • 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.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL