change at runtime font outlook

User avatar
sal21
PlatinumLounger
Posts: 4335
Joined: 26 Apr 2010, 17:36

change at runtime font outlook

Post by sal21 »

To default when i post a new message i have calibri 11 font (see image)

Now i use this code to send email via vba code:

Code: Select all

....
dim .....
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

 With OutMail
        .SentOnBehalfOfName = "ttrtry"
        .To = DESTINATARIO
        .CC = DESTINATARIO1
        .Subject = "retrtretert."
        .HTMLBody = strMessage
        '.display
        .Send
        On Error GoTo 0

    End With

Set OutMail = Nothing
Set OutApp = Nothing
....


is possible to chenge the default font before send email, in arial 8????? exists a param of OutMail or OutApp to changing...????
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78351
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: change at runtime font outlook

Post by HansV »

You can change the font of the message text to Arial. Try:

Code: Select all

        .HTMLBody = "<font face=Arial>" & strMessage & "</font>"
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4335
Joined: 26 Apr 2010, 17:36

Re: change at runtime font outlook

Post by sal21 »

HansV wrote:You can change the font of the message text to Arial. Try:

Code: Select all

        .HTMLBody = "<font face=Arial>" & strMessage & "</font>"

Googoling....
To help other user:

objMessage.HTMLBody = "<div style='font-family:Arial;font-size:9pt;'>" & objMessage.HTMLBody & "</div>"wath you think about?

Tks in other case for suggestion :thankyou:

User avatar
HansV
Administrator
Posts: 78351
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: change at runtime font outlook

Post by HansV »

That is even better, especially if you want to use Calibri 12 instead of Arial 8 as you asked. :smile:
Best wishes,
Hans