Macro to change fonts

M

maperalia

Can somebody help me to get a macro to update fonts in words:
1.- From page 1 to page 3 "Times NewRoman size 12"
2.- From page 4 to the end "Arial size 8"

Thanks.
Maperalia
 
T

Tony Jollans

Well, the blunt approach is to select pages 1 to 3 and Format > Font and
select TNR, 12 ... and then to select page 4 on and go to Format > Font and
select Arial, 8

But if you are using styles well there may be a better way.
 
M

maperalia

Tony;
Thanks for your quick response.
I have a macro that "Change Sources" and "Update Links" into the word file
from an excel file. Usually the links's font gotten into the word file change
by themself to any font so I have to adjust them manually.
Therefore, I want to add a statement in the program to do it automatically.
I wanted to record the macro but did not let me select the fonts by pages.
Just allow me to do it select all.

Do you think you vcan help me with this matter?

Thanks in advance.
Maperalia.
 
T

Tony Jollans

Yes, selecting by page is awkward but this will do it - and something pretty
similar could have been recorded -

ActiveDocument.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=4
With Selection
.HomeKey Unit:=wdStory, Extend:=wdExtend
.Font.Name = "Times New Roman"
.Font.Size = 12
.Collapse wdCollapseEnd
.EndKey Unit:=wdStory, Extend:=wdExtend
.Font.Name = "Arial"
.Font.Size = 8
End With

One point to be aware of is that changes to the font can cause changes to
the pagination - the above code takes care of this by selecting the second
part from the end of the first selection.
 
M

maperalia

Tony;
Thanks for the code. However, the program changes all pages to arial only.
Is there is any way to select from page 1 to 3 TNR size 12 and from page 4
to the end arial sieze 8

Best regards.
Maperalia
 
T

Tony Jollans

Hi Maperalia,

It works for me, and I don't see how it could change the first three pages
to Arial. In your previous post you seemed to say that your were
experiencing random font changes which I don't understand either. It may be
that whatever causes the first problem also causes the second but I don't
know what it may be. Sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top