Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Changing fonts throughout document including headers footers and footnotes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kim - 15 Jan 2007 14:58 GMT
I need to create a macro to change all fonts of "Times" to "Times New
Roman" in a document. I have that code below. However, my code does not
change the font in some places, for example, in some parts of tables,
headers/footers and in footnotes. How do I add to this code to cover
those areas too?

Sub Times_to_TNR()
'
' Times_to_TNR Macro
' Macro created 1/13/2007 by
'

' Turn screen updating off
Application.ScreenUpdating = False

 Selection.HomeKey Unit:=wdStory
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
       With Selection.Find
'**********************
       .Text = ""
       .Font.Name = "Times"

       .Replacement.Text = ""
       .Replacement.Font.Name = "Times New Roman"
'**********************
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
 MsgBox "Done converting font style Times to Times New Roman",
vbOKOnly
 
End Sub
Kim - 15 Jan 2007 17:08 GMT
> I need to create a macro to change all fonts of "Times" to "Times New
> Roman" in a document. I have that code below. However, my code does not
[quoted text clipped - 36 lines]
>  
> End Sub

Reposting to word.vba.general. Sorry!
macropod - 21 Jan 2007 01:38 GMT
Hi Kim,

It's generally not good practice to change character formatting this way. The
preferred way to change the formatting of the underlying paragraph styles.
Doing it this way deals with all text in the document, plus any that may be
added later.

Cheers

Signature

macropod
[MVP - Microsoft Word]

| I need to create a macro to change all fonts of "Times" to "Times New
| Roman" in a document. I have that code below. However, my code does not
[quoted text clipped - 36 lines]
|
| End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.