More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 19-Dec-2014 07:11

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.

Login Password
Remember me
Register | Send my password
    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
Topic
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") & _
     "\Microsoft\Signatures\Santander.htm"

    If Dir(SigString) <> "" Then
        Signature = GetBoiler(SigString)
    Else
        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
        .Display
    End With
    
      
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
 

  16-Oct-2012  20:42
  18-Oct-2012  19:08   
See http://www.outlookcode.com/article.aspx?id=31

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

Sub font()
' http://answers.microsoft.com/en-us/office/forum/office_2003-excel/vba-how-to-change-font-color-etc-in-an-email/67d1201f-806b-e011-8dfc-68b599b31bf5?msgId=e7029559-876b-e011-8dfc-68b599b31bf5
    
    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
  
    msg.Display
    Set msg = Nothing

End Sub
    Page [ 1 ]