More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 27-Nov-2015 19:25

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

    Page [ 1 ]  
 Code Essentials Printer Friendly Version
Beginner’s section on how to work in the VBA environment, how to work with functions and expressions – generally not specific to Outlook
Changing font in Outlook
I have code from excel to create an email and copy data to the email. The information copied over always goes to times new roman, and I need it to be in Calibri 11. Appreciate any help I can get, thanks.

Sub Mail_Outlook_With_Signature_Html()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim SigString As String
    Dim Signature As String

    If Range("a2") = Empty Then
    MsgBox "Select Service and try again."
    Exit Sub
    End If
    If Range("b2") = Empty Then
    MsgBox "Select Issue and try again."
    Exit Sub
    End If
    If Range("a5") = Empty Then
    MsgBox "Select Calls in Queue and try again."
    Exit Sub
    End If
    If Range("b5") = Empty Then
    MsgBox "Select Minutes and try again."
    Exit Sub
    End If
    If Range("a8") = Empty Then
    MsgBox "Select Number of Agents or Managers and try again."
    Exit Sub
    End If
    If Range("b8") = Empty Then
    MsgBox "Select Status and try again."
    Exit Sub
    End If
    If Range("h2") = Empty Then
    MsgBox "Select Cause and try again."
    Exit Sub
    End If
    MsgBox "Please review the body of your email before you send."
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
        SigString = Environ("appdata") & _

    If Dir(SigString) <> "" Then
        Signature = GetBoiler(SigString)
        Signature = ""
    End If

    On Error Resume Next
    With OutMail
        .To = Sheets("Communications").Range("a17")
        .CC = "my team"
        .BCC = ""
        .Subject = Sheets("Communications").Range("a20")
        .HTMLBody = Sheets("Communications").Range("a25") & Signature
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

  16-Oct-2012  20:42
  18-Oct-2012  19:08   

With the method below it appears Calibri size 11 is not avaialable.

Sub font()
    Dim msg As Outlook.MailItem
    Dim mesgBody As String
    Set msg = Application.CreateItem(olMailItem)
    msg.Subject = "Font"
    mesgBody = mesgBody & "<p><font face=""Calibri"" size=""3"" color=""red""><b>Please let me know if you have any questions.</b></font></p><p></p>"
    mesgBody = mesgBody & "<p><font face=""Calibri"" size=""2"" color=""blue""><i>Thanks and have a great week!</i></font></p>"
    mesgBody = mesgBody & "<p><font face=""Calibri"" size=""1"" color=""green""><u>SW</u></font></p>"

    msg.HTMLBody = mesgBody
    Set msg = Nothing

End Sub
    Page [ 1 ]