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


How to insert signature into Outlook email when sending by vba in Excel?

When sending email by running VBA code in Excel, the Outlook signature will not be displayed in the email body automatically. This article is talking about sending email with Outlook signature displaying in the email body by VBA code in Excel.

Insert signature into Outlook email when sending by Excel VBA

Easily send email through Outlook based on created mailing list:

The Send Emails utility of Kutools for Excel helps users sending email through Outlook based on created mailing list in Excel. See screen shot:

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now

Insert signature into Outlook email when sending by Excel VBA

Supposing you need to send emails to a list of email addresses include the Outlook signature in all sending emails. Please do as follows.

1. Please replace the .Body line in below VBA 2 with the code in VBA 1. And in the VBA 2, move the .Display line up until it locates below the With xMailOut line.

VBA 1: Template of send email with signature in Excel

.HTMLBody = "This is a test email sending in Excel" & "<br>" & .HTMLBody

VBA 2: Send email to email addresses specified in cells in Excel

Sub SendEmailToAddressInCells()
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xRgVal As String
    Dim xAddress As String
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select email address range", "KuTools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xRg = xRg.SpecialCells(xlCellTypeConstants, xlTextValues)
    For Each xRgEach In xRg
        xRgVal = xRgEach.Value
        If xRgVal Like "?*@?*.?*" Then
            Set xMailOut = xOutApp.CreateItem(olMailItem)
            With xMailOut
                .To = xRgVal
                .Subject = "Test"
                .Body = "Dear " _
                      & vbNewLine & vbNewLine & _
                        "This is a test email " & _
                        "sending in Excel"
            End With
        End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

The following screenshot can help you to easily find the differences after changing the VBA code.

After running the VBA code, you can see the default Outlook signature is inserted into the created emails’ body automatically as below screenshot shown.

Related articles:

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
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.
    Kasun · 27 days ago
    Thanks a lot...
  • To post as a guest, your comment is unpublished.
    Prakash · 5 months ago
  • To post as a guest, your comment is unpublished.
    Michael · 8 months ago
    I'm having trouble running this on excel 2016. I get a "Compile Error: User Defined Type Not Defined" message. Please help!
  • To post as a guest, your comment is unpublished.
    Maggie · 8 months ago
    If my body text is linked to pull from excel fields, the use of & .HTMLBody at the end of the string erases all of the body text and just leaves the signature.
  • To post as a guest, your comment is unpublished.
    viraj Shirsat · 11 months ago
    how to add signature if the macro is used by multiple user.
    for eg my macro will be run by 3 other persons as well. So how can the macro use the signature of the user who is running the macro.
    thanks in advance
    • To post as a guest, your comment is unpublished.
      crystal · 9 months ago
      Good Day,
      The VBA code can automatically recognize the default signature in the Outlook of the sender, and send email with his own signature through Outlook.