'Draft emails with email signature

i am trying to send emails through excel and keep the email signature i am able to either save .body as text withough the image or insert the image through .HTMLbody but this messes up the text format any idea how i can have it either keep or insert the image withough changing the text format

Sub email()
'Microsoft Outlook XX.X Object Library is required to run this code
'Variable declaration
Dim objOutlook As Outlook.Application
Dim objMail As Outlook.MailItem
Dim lCounter As Long
Dim signature As String

'Set objects
Set objOutlook = Outlook.Application

'Read details from Excel sheet and draft emails
    'You can change the counter as per requirement
    'Create a new email item
    
    Set objMail = objOutlook.CreateItem(olMailItem)
    objMail.Display
    signature = objMail.Body
    
    'To
    objMail.To = "[email protected]"
    'Cc
    objMail.CC = ""
    'Subject
    objMail.Subject = "subject here"
    'Email Body
    objMail.Body = "whatever i want" & objMail.Body
    objMail.HTMLBody = vbCrLf & "<img src='K:\Capital One\Noting Program and spreadsheets\Admin Controls for automations team\Email signature DO NOT USE\email signature.PNG'>"
    'Add Attachment
    'objMail.Attachments.Add
    'Draft email
    objMail.Display
    objMail.Send
    'Close the object
    Set objMail = Nothing
    
'Show confirmation message to user
MsgBox "Done", vbInformation
End Sub


Solution 1:[1]

Don't use the Body and HTMLBody property in the same place or if you want to preserve formatting. The HTMLBody allows you adding any images, but you need to remember that you deal with a valid HTML document. So, you can insert the image between the opening <body> and closing </body> tags.

If you need to get the signature added first, you need to call the Display and then get or modify the HTMLBody property.

Solution 2:[2]

This code will use your signature you have set in Outlook.

Dim Signature As Variant

With OutMail
    'Capture signature block.
    .Display
     Signature = .HTMLBody
    .To = ""
    .CC = ""
    .Subject = "Build Plan"
    .HTMLBody = "Hello George," & "<br><br>" & _
    "Please incorporate these numbers into your next build schedule." & "<br>br>" & Signature
    .Display    'or .Send
End With

Solution 3:[3]

Do not use plain text Body property at all, always set HTMLBody.

Keep in mind that you need to merge your own data with the existing HTMLBody (populated with the signature when Display is called) - find the position of the "<body" string, find the position of the next ">" (to take care of <body> tags with attributes), then insert your own HTML after that ">".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev
Solution 2 XLmatters
Solution 3