VBA email signature from secondary account


Board Regular
Feb 28, 2016
Office Version
I have a problem choosing the correct signature when sending mail from Excel via Outlook (Office365). I have 2 accounts set up in Outlook, one is primary email and the other is secondary email with both having different default signatures. Secondary email is a shared mailbox, but added as a separate account with full rights. The goal is to both send out and add the signature from the secondary account.

.Display opens up new mail item while adding Outlook's signature and .SentOnBehalfOfName even shows the secondary account in FROM panel (and also sends out the mail from that account), however Outlook still grabs the signature from primary email account.

In case I manually choose (or re-select) the secondary account from the mail message's FROM drop-down menu, Outlook will change the signature to the right one, however that's really not an option as I'm looking to automate this (uncomment .Send) and run this code in a loop for a few times in a row. I did try making the secondary address as the default address, however ran into additional problems and felt there should be a better way to handle this.

Any ideas please?

I have tried the option of linking to the AppData folder to grab the signature HTML file, however it does have a pic included which appears to be a problem.

Sub Email()
    Dim OutApp As Object
    Dim OutMail As Object
    On Error Resume Next
    On Error GoTo 0

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail  
        .SentOnBehalfOfName = "secondary@email.com"
        .To = "test@email.com"
        .CC = ""
        .BCC = ""
        .Subject = "mySubject"
        .HTMLBody = "[FONT=calibri][SIZE=3]mailBody text[/SIZE][/FONT]" & .HTMLBody
    End With
    On Error GoTo 0

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
Last edited:

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Latest member

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...