A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Specify Font Name or Face using VBA Macro in Word



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 2nd 09, 07:32 PM posted to microsoft.public.outlook.program_vba
JBark
external usenet poster
 
Posts: 6
Default Specify Font Name or Face using VBA Macro in Word

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 = "
..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

Ads
  #2  
Old July 3rd 09, 03:49 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Specify Font Name or Face using VBA Macro in Word

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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JBark" wrote in message
...
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 = "
.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



  #3  
Old July 6th 09, 04:16 PM posted to microsoft.public.outlook.program_vba
JBark
external usenet poster
 
Posts: 6
Default Specify Font Name or Face using VBA Macro in Word

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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JBark" wrote in message
...
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 = "
.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




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I change the font face and size for whole text in .eml zero Outlook Express 3 December 2nd 08 07:08 PM
Font issues between Word and Outlook Koons Outlook - General Queries 0 April 18th 07 10:37 PM
Outlook macro abends but Word macro runs successfully Jreue Outlook and VBA 0 December 14th 06 12:55 AM
Outlook Express type face/font settings. Alan Outlook Express 3 December 8th 06 01:05 PM
Macro to change font of selected text in mail message? Joe HM Outlook and VBA 1 April 6th 06 07:06 PM


All times are GMT +1. The time now is 04:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.