Choosing a font for emails.

Brando

Enthusiastic Novice
Local time
Today, 13:55
Joined
Apr 4, 2006
Messages
100
I've searched several formus with no luck. I would like to have Access launch an Outlook email with a specific font (Arial). How could that be accomplished? Here's my code:

Code:
Private Sub cmdEmailAO_Click()
On Error Resume Next
Dim OApp As Object, OMail As Object, signature As String, Email As String, FirstName As String
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
    With OMail
    .Display
    End With
        signature = OMail.Body
        Email = DLookup("Associate", "tblCodes", "Code = cboCode")
        FirstName = DLookup("FirstName", "tblCodes", "Code = cboCode")
    With OMail
    .To = Email
    .Subject = "Cadre review of a " & Me!cboLoanType & "; Borrower: " & Me!txtBorrower & "; Loan #: " & Me!txtLoanNo
    .Body = FirstName & "," & vbNewLine & "" & vbNewLine & "" & vbNewLine & "" & vbNewLine & "Thank you," & vbNewLine & signature
    End With
Set OMail = Nothing
Set OApp = Nothing

Exit_cmdEmailAO_Click:

Exit Sub

End Sub

Thank you in advance for your help.
 
Thank you. I found that one too, however, I couldn't get it to work. I'll try more variations.
 
I hadn't seen that one, however, it looks like it was incomplete. I tried it anyway with no luck. The reason I want to set the font is because the user may want to add to the body of the message. But when typing on the end of the words that are auto generated, it uses a different font :(. Not the end of the world, but it doesn't look very professional.
 
Can you post what you have now... because Hans is usually right bout these things. And if it worked for the Poster it should work for you.
 
Thank you for your help on this. I'm a little embarrassed to post the code at this point, but this was my best effort at understanding Hans' solution.

Code:
Private Sub cmdEmailHO_Click()
On Error Resume Next

    Msg = "<b>Hello " & "John Smith" & "</b><br>" & _
    "<i>How are you?</i>"
    Msg = Msg & "Below you will find your Alert Type and Count for the week.  " & _
    "These alerts need to be resolved by 5pm CST on Friday " & _
    "to receive 100% Alert Resolution for the week." & vbCrLf & vbCrLf
    Msg = Msg & "Your alerts for " & Dept & " are:" & vbCrLf & vbCrLf & AC1 & AT1 & vbCrLf & AC2 & AT2 & vbCrLf & AC3 & AT3 & vbCrLf & _
    AC4 & AT4 & vbCrLf & AC5 & AT5 & vbCrLf & AC6 & AT6 & vbCrLf
    Msg = Msg & "<p><font face=""Comic Sans MS"" size=""3"" color=""red""><b>Please let me know if you have any questions.</b></font></p><p></p>"
    Msg = Msg & "<p><font face=""Times New Roman"" size=""2"" color=""blue""><i>Thanks and have a great week!</i></font></p>"
    Msg = Msg & "<p><font face=""Arial"" size=""1"" color=""green""><u>" & SW & "</u></font></p>"
     
    'Create Mail Item
    Set Mitem = OutlookApp.CreateItem(0)
    With Mitem
    .To = "John Smith"
    .Subject = "Test"
    .Body = Msg
            
    .BodyFormat = 2 ' olFormatHTML
    .BodyHTML = Msg
    
    ' .Send
    End With

End Sub
 
Change this...

Code:
.BodyHTML = Msg
to...
Code:
.HTMLBody = Msg
 
I wasn't able to get the above to work, however, my problem was solved when I simply put spaces after each predetermined phrase. For example:

Code:
.Body = FirstName & "," & vbNewLine & vbNewLine & "Please attend the meeting" & vbNewLine & vbNewLine & "Thank you," & vbNewLine & signature
Code:

Became this...

Code:
.Body = FirstName & "," & vbNewLine & vbNewLine & "Please attend the meeting " & vbNewLine & vbNewLine & "Thank you, " & vbNewLine & signature
Code:

A simple solution for my simple mind. And now the font is consistent when someone adds to the message.
Thank you all for your time on this.

Brando
 

Users who are viewing this thread

Back
Top Bottom