• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Auto Outlook Signature of users sending email

Prakash M

New Member
Hello Experts,

I'm using below source of code for copying a range from excel and adding to Outlook email for sending email.

So far this is working good.

But I do not see default outlook signature getting added at the end of email. There are many users, who will be using the excel for sending emails, so outlook to pick default signature of the user sending the email.

Please advise

Code:
Sub RectangleRoundedCorners2_Click()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim rng As Range
    Dim s2 As Worksheet
    Dim lr As Long

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    Set s2 = ThisWorkbook.Sheets("Summary")
    Set rng = Nothing
    
    
    On Error Resume Next
    lr = Cells(Rows.Count, 2).End(xlUp).Row
    Set rng = s2.Range("B2:J" & lr)
    On Error GoTo 0

    If rng Is Nothing Then
        MsgBox "The selection is not a range or the sheet is protected" & _
               vbNewLine & "please correct and try again.", vbOKOnly
        Exit Sub
    End If
        
        With OutMail
        .To = Range("C4").Value
        .CC = ""
        .Subject = s2.Range("B2").Value & " - " & s2.Range("C2").Value
        
        .Htmlbody = "<font face=""arial"" color=""black""> Hello," & "<br><br>" & "Some Text Here" & "<br><br>" & "Some Text Here" & "<br><br>" & "Some Text Here" _
        & vbNewLine & RangetoHTML(rng) & "<br>"
        .Htmlbody = .Htmlbody & "Some Text Here<font> <br>"
        .Htmlbody = .Htmlbody & " <li>Some Text Here</li> <Body><HTML>"
        
        .Display
   End With
            
   Set OutMail = Nothing
   Set OutApp = Nothing
  
End Sub
 
Top