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 / February 2007

Tip: Looking for answers? Try searching our database.

Macro to change font

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mickey - 02 Feb 2007 15:49 GMT
Does any know if there is a macro that will change the font in all the tables
in a document?

Thanks,
Mickey
Edward Thrashcort - 02 Feb 2007 16:00 GMT
record a macro that changes the font if you don't know the code
to make the change you require, then create a macro that wraps
the recorded code in a for-loop

Sub tablefontchange()
Dim aTable As Table
For Each aTable In ActiveDocument.Tables
   aTable.Select
   Selection.Font.Name = "Times New Roman"
Next
End Sub

Eddie
Mickey - 02 Feb 2007 16:09 GMT
Works great.  Thank you so much.

> record a macro that changes the font if you don't know the code
> to make the change you require, then create a macro that wraps
[quoted text clipped - 9 lines]
>
> Eddie
Greg Maxey - 02 Feb 2007 16:40 GMT
Eddie,

You might want to consider using "range" for this sort of thing.
There is no need to actually select the individual tables.

Sub tablefontchange()
Dim aTable As Table
For Each aTable In ActiveDocument.Tables
   aTable.Range.Font.Name = "Times New Romanl"
Next
End Sub

On Feb 2, 11:00 am, IdontWantS...@nospam.net (Edward Thrashcort)
wrote:
> record a macro that changes the font if you don't know the code
> to make the change you require, then create a macro that wraps
[quoted text clipped - 9 lines]
>
> Eddie
Edward Thrashcort - 02 Feb 2007 19:00 GMT
Yep I know.

I couldn't be bothered to load word to get the syntax right so I wrote it
from memory the easy way.

The Selection object, although functional, can be fraught with gotchas

Eddie

> *From:* "Greg Maxey" <gmaxey@mvps.org>
> *Date:* 2 Feb 2007 08:40:11 -0800
[quoted text clipped - 26 lines]
> >
> > Eddie
 
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.