Multiple signatures in email

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
I am using a script from Run De Bruin to email from excel.
However it pulls the signature from the default email account.
How can i create multiple signatures and swap them based on a cells content?
IE. if b1 - mike then the email would be mikes signature, if b1 = steve then it would use steve's signature.


Code:
' Get default email signature without blinking (instead of .Display method)
    With .GetInspector: End With
    sSignature = .htmlbody
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Re: Multiple signitures in email

How do I get this code to read/display the art work /picture in the signature?
It is only displaying the text and a red placeholder for the pic.

Code:
Sub testemail()
[COLOR=#008000]'-----------------------------------------
'DETERMINE IF EMAIL TO BE SENT[/COLOR]
If MsgBox("Send Email?", vbYesNo + vbQuestion, "Email") = vbYes Then
[COLOR=#008000]'-----------------------------------------
'DECLARE AND SET VARIABLES[/COLOR]
    Dim myOutlok As Object
    Dim myMailItm As Object
    Dim Signature As String
    Shell ("OUTLOOK")
    Set otlApp = CreateObject("Outlook.Application")
    Set OtlNewMail = otlApp.CreateItem(olMailItem)
[COLOR=#008000]'-----------------------------------------
'GET DEFAULT EMAIL SIGNATURE[/COLOR]
    Signature = Environ("appdata") & "\Microsoft\Signatures\"
    If Dir(Signature, vbDirectory) <> vbNullString Then
        Signature = Signature & Dir$(Signature & "*.htm")
    Else:
        Signature = ""
    End If
    Signature = CreateObject("Scripting.FileSystemObject").GetFile(Signature).OpenAsTextStream(1, -2).ReadAll
[COLOR=#008000]'-----------------------------------------
'CREATE EMAIL[/COLOR]
    OtlNewMail.HTMLBody = Signature
    With OtlNewMail
    .To = Range("H9").Value
    .CC = Range("H10").Value
    .Subject = Range("H11").Value
    .HTMLBody = "Hello," & "<br />" & Range("H12").Value & "<br />" & "<br />" & "<br />" & _
        "Thank you," & "<br />" & "<br />" & Signature
    .display
    '.Send
    End With
[COLOR=#008000]'-----------------------------------------
'CLEANUP[/COLOR]
    Set OtlNewMail = Nothing
    Set otlApp = Nothing
    Set otlAttach = Nothing
    Set otlMess = Nothing
    Set otlNSpace = Nothing
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,055
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top