Specify Font Name or Face using VBA Macro in Word

Status
Not open for further replies.
J

JBark

Hello - when I use vba to create an Outlook mail item using Word 2003 as the

email editor, can I specify the font to be used in my vba macro code? Right

now it pulls whatever the user has set as the default in Word under Tools

Options > General > Email Options > Personal Stationary. I tried the code

listed below, but it has no effect. Thanks for any suggestions.

Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem

> .To = "email@address.com"

> .Subject = "MySubject"

'Add the document as an attachment, you can use the .displayname property

'to set the description that's used in the message

> .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue

> .Body = ActiveDocument.Content

> .Font.Name = "Verdana"

> .Send

End With
 
If you use the object browser (F2 in VBA), you'll see that no Outlook

objects have any kind of Font property. You have two choices -- set the

value of the HTMLBody property using fully tagged HTML code (same as in a

web page) or use oItem.GetInspector.WordEditor to return a Word.Document

object and use Word methods to format it. See

http://www.outlookcode.com/article.aspx?id=31 for more information.

Sue Mosher

"JBark" <JBark> wrote in message

news:79940943-95D1-424F-A3FF-0E939987E6E8@microsoft.com...
> Hello - when I use vba to create an Outlook mail item using Word 2003 as
> the
> email editor, can I specify the font to be used in my vba macro code?
> Right
> now it pulls whatever the user has set as the default in Word under Tools
> >

> Options > General > Email Options > Personal Stationary. I tried the code
> listed below, but it has no effect. Thanks for any suggestions.

> Set oItem = oOutlookApp.CreateItem(olMailItem)
> With oItem
> .To = "email@address.com"
> .Subject = "MySubject"
> 'Add the document as an attachment, you can use the .displayname property
> 'to set the description that's used in the message
> .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
> .Body = ActiveDocument.Content
> .Font.Name = "Verdana"
> .Send
> End With
>
 
Thanks Sue - I will check it out and read up on it!

"Sue Mosher [MVP]" wrote:


> If you use the object browser (F2 in VBA), you'll see that no Outlook
> objects have any kind of Font property. You have two choices -- set the
> value of the HTMLBody property using fully tagged HTML code (same as in a
> web page) or use oItem.GetInspector.WordEditor to return a Word.Document
> object and use Word methods to format it. See
> http://www.outlookcode.com/article.aspx?id=31 for more information.
> > Sue Mosher
> > >

> "JBark" <JBark> wrote in message
> news:79940943-95D1-424F-A3FF-0E939987E6E8@microsoft.com...
> > Hello - when I use vba to create an Outlook mail item using Word 2003 as
> > the
> > email editor, can I specify the font to be used in my vba macro code?
> > Right
> > now it pulls whatever the user has set as the default in Word under Tools
> > >

> > Options > General > Email Options > Personal Stationary. I tried the code
> > listed below, but it has no effect. Thanks for any suggestions.
> > Set oItem = oOutlookApp.CreateItem(olMailItem)
> > With oItem
> > .To = "email@address.com"
> > .Subject = "MySubject"
> > 'Add the document as an attachment, you can use the .displayname property
> > 'to set the description that's used in the message
> > .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
> > .Body = ActiveDocument.Content
> > .Font.Name = "Verdana"
> > .Send
> > End With
> >


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
David in Mississippi New (Feb 2020) install of Outlook 365 - Cannot specify PST for different accounts Using Outlook 0
H How can I specify which calendar to display Using Outlook 1
R specify from account in mail merge Using Outlook 3
T Specify formatting of HTMLBody in and outlook message Outlook VBA and Custom Forms 5
D Re: How to specify the "current entry id" to GetItemFromID? Outlook VBA and Custom Forms 1
MattC Changing the font of an email with VBA Outlook VBA and Custom Forms 1
S Appointment font size when printing only changes Tasks' font Using Outlook 0
J Increase read pane font size, but NOT image size? Using Outlook 3
O Outlook - How to embed font ? (If at all possible) Using Outlook 2
P default font when sending email from browser Using Outlook 1
e_a_g_l_e_p_i Adjusting font size in folders Using Outlook 1
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
K Font Sizing in Custom Form Regions for Contacts Outlook VBA and Custom Forms 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
P Changing the font that the task view shows Using Outlook 5
S Customize the autocolor font choices for replying/forwarding messages Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Outlook 2010 How can I change the font size on right side appointment pane Using Outlook 12
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
T Outlook Contacts ... Changing Font Size, Style, Bold, etc. Using Outlook 2
F Default font for notes in contacts Using Outlook 1
Marc2019 Outlook 2016 Font Problem Using Outlook 5
S Outlook 2010 unable to change default font Using Outlook 7
M Message list font changed after update Using Outlook 2
P Message List Font Changed Using Outlook 6
B Change font of reminder of an email header Outlook VBA and Custom Forms 3
R Setting font and color used when replying to an email Outlook VBA and Custom Forms 3
CWM030 Call me old if you want. OL 2016 font size out of the box. Using Outlook 3
M Outlook 2016: Changing default font for Notes and Reading Pane Using Outlook 4
D font control by keyboard Using Outlook 2
M font format discrepancies with Quick Parts Using Outlook 1
Steven 2007 New PC vs Old PC - Micro Font on Inbound Emails :( Using Outlook 4
D Font in Reply is much larger than normal, how to reset ...? Using Outlook 4
Rupert Dragwater Can't change font size Using Outlook 5
O How to paste website content using a specific font and removing URLs Using Outlook 2
T "From" field font size in table list of emails Using Outlook 0
K Paste from Windows Clipboard then change font without losing formatting Outlook VBA and Custom Forms 1
S Default Font in body of Task Using Outlook 0
O VBA to Run Font Change on Outlook Startup Outlook VBA and Custom Forms 4
Diane Poremsky How to Change the Font used for Outlook's RSS Feeds Using Outlook 0
S Outlook 2007, windows 10 Font size Using Outlook 1
L Outlook 2007 Font Using Outlook 3
J Increase font size of message body Using Outlook 5
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2
J Font size changed in new mail messages Using Outlook 5
Rupert Dragwater unable to change font sizes in some replies Using Outlook 3
D Conditional formatting - font sizes Using Outlook 3
O How to increase Font size in Outlook 2013 Using Outlook 1
Fozzie Bear Change the colour or font of individual email accounts in outlook 2010/13 Using Outlook 1
K Untitled Appointment Font Using Outlook 1
J Change Default View - Color and font Using Outlook 3

Similar threads

Back
Top