Hi all,

I would be eternally grateful if anyone can help me out!!

I made a macro (using a lot of Googling) to use Excel's VBA to open a new email in Outlook, add the contacts, attachments etc, fill in some text and add the user's default signature. This was made a few weeks ago when we were using Outlook 2013 and it worked beautifully!

This week we have just all been upgraded to Outlook 2016 and suddenly it stopped working! I have managed to get it functional now but the only thing that is still completely stumping me is attaching the signature! According to a million internet searches, this should work, but for some reason it doesn't like the line where I define the signature.

It was a lot more complicated before and used early binding instead of late binding but I have managed to get it down to the bare bones below. Commenting out the signature line makes it run fine, but with it keeps on throwing back that pesky error!! (Just a side note, I need to use .HTMLBody instead of .body because I have a table to insert but have tried both with the same effect.)

    Dim OutApp As Object
    Dim objOutlookMsg As Object
    Dim signature As String
    Set OutApp = CreateObject("Outlook.Application")
    Set objOutlookMsg = OutApp.CreateItem(0)
        
    objOutlookMsg.Display
    signature = objOutlookMsg.HTMLBody    'Run-time error 287: application defined or object defined error
    
    With objOutlookMsg
      .To = "xxx"
      .subject = "blah"
      .HTMLBody = "blah blah blah" & vbNewLine & signature
    End With