Change HTML email type and font size in VBA

I have a VBA script that generates and sends emails when the VBA button is clicked on this sheet.

The script is currently creating an email in a relatively small font. I was wondering if there is a way to install the Calibri font and the text is exactly 11.

Here is the current VBA script:

Private Sub CommandButton1_Click()

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim strUser As String
Dim signature As String
Dim sTo As String
Dim sCC As String
    'For To field
    Set emailRng = Worksheets("Send Email").Range("D3:I6")

    For Each cl In emailRng
        sTo = sTo & ";" & cl.Value
    Next

    sTo = Mid(sTo, 2)

    'For CC field
    Set emailRngCC = Worksheets("Send Email").Range("D8:I11")

    For Each cl In emailRngCC
        sCC = sCC & ";" & cl.Value
    Next

    sCC = Mid(sCC, 2)


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .Display
    End With
        signature = OutMail.HTMLBody


    strbody = "<FONT SIZE = 3>Good Morning;<p>We have completed our main aliasing process for today.  All assigned firms are complete.  Please feel free to respond with any questions.<p>Thank you."

    With OutMail
        .SentOnBehalfOfName = ""
        .To = sTo
        .CC = sCC
        .BCC = ""
        .Subject = "Data Morning Alias Process - COMPLETE"
        .HTMLBody = strbody & signature
        .Display
    End With
End Sub

I know this part of the code:

strbody = "<FONT SIZE = 3.5>Good Morning;<p>We have completed our main aliasing

- This is the part related to the size of the text text of the email. But setting 3 is small, and setting 4 is too large. So I'm just wondering if there is a way to set the font to exactly 11 and the text will be formatted as Calibri?

Thank!

+4
source share
2

:

strbody = "<BODY style=font-size:11pt;font-family:Calibri>Good Morning;<p>We have completed our main aliasing process for today.  All assigned firms are complete.  Please feel free to respond with any questions.<p>Thank you.</BODY>"

-, "font-size=11pt" <font size=5>, , , , 1-7, .

simpLE MAn .

+11

FYI , , , ( Gill Alt One MT Light), :

strbody= "<BODY style=" & Chr(34) & "font-family:Gill Alt One MT Light" & Chr(34) & ">" & YOUR_TEXT & "</BODY>"
0

Source: https://habr.com/ru/post/1530258/


All Articles