Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Macro Help - Font Size 1

Status
Not open for further replies.

ctully

IS-IT--Management
Oct 7, 2004
7
CA
Can anyone suggest an easy way to increase the font size of an entire document (including headers/footers) by a certain percentage? I know I can do it by going through word by word and setting the font size to the original font size multiplied by a factor, but thsi seems slow and tedious. Is there a better way?

I have a document that needs to print in different font size under dofferent circumstances and I do not want to maintain two versions of it.

Any ideas?

TIA
 
There isn't any real easy way to do the whole thing by percentage, but you can grow font sizes incrementally so larger fonts will remain larger but not by the same percentage. To see what will happen, do Ctrl+A to select all and then Ctrl+> a few times. If it suits, the code is simply
Code:
Selection.Font.Grow
You will need to loop through each Story to pick up the headers and footers etc. - and you'll need to work out (or guess) approximately how many times to Grow - 3 or 4 increments seems to increase by about 50%.

I think you'll need some fairly slow and complex code to better this, even though it's not exactly what you asked for - but I have been wrong before!

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Actually, there is an easy way to do the whole thing by percent.

Code:
ActiveDocument.Content.Font.Scaling = 113
will scale the font to 113% of the original. So:
Code:
Dim i As Integer
i = Inputbox("Enter a percentage number.")
ActiveDocument.Content.Font.Scaling = i
will set the font size by i.

As Tony mentions, you would have to loop through the Stories to get everything. It may be better to make explicit Range objects for each story.

Caveats. Word does funny things with this if you have made partial manual changes to a paragraph. In other words, if you have changed font attributes for part of a pargraph, manually.

Of course, if you are properly using Styles there are no problems.

Gerry
 
I should have known there would be an easy way.

Thank you Gerry. Star for you.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Unfortunately scaling is not the answer. It does a horizontal scaling while leaving the height in tact. This will skew the text, not desirable in this situation so the grow is actually closer to s solution. Any other ideas anyone?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top