Macro programmers -

I need a macro that changes fonts in a document from:
Goudy Old Style to Garamond
-and-
Avenir 45 to Gill Sans MT

If there are other fonts in the document I want to leave them as is. I
am only concerned with the above 2 fonts.

Thanks in advance for your help.

Re: Conditional macro to change font by Jonathan

Jonathan
Wed Sep 12 09:39:14 CDT 2007


<minditservices@gmail.com> wrote in message
news:1189606048.406253.51660@22g2000hsm.googlegroups.com...
> Macro programmers -
>
> I need a macro that changes fonts in a document from:
> Goudy Old Style to Garamond
> -and-
> Avenir 45 to Gill Sans MT
>
> If there are other fonts in the document I want to leave them as is. I
> am only concerned with the above 2 fonts.
>
> Thanks in advance for your help.
>

You don't need a macro for this. Go to Edit, Replace. On the dialog that
appears, click More. Place the cursor in the Find What box, an click Format,
then Font. On the dialog that appears select the font you want to change
from, and click OK. Then position the cursor in the Replace With box, click
Format, Font, and select the font you want to change to. Make sure that both
the Find What and Replace With boxes have no text, then click Replace All.

Repeat for each font you want to replace.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



Re: Conditional macro to change font by m

m
Wed Sep 12 12:18:18 CDT 2007

And in case you do want a macro for this, just follow Jonathan's advice
while using the macro recorder.

"Jonathan West" <jwest@mvps.org> wrote in message
news:e%23UbCrU9HHA.3716@TK2MSFTNGP03.phx.gbl...
>
> <minditservices@gmail.com> wrote in message
> news:1189606048.406253.51660@22g2000hsm.googlegroups.com...
>> Macro programmers -
>>
>> I need a macro that changes fonts in a document from:
>> Goudy Old Style to Garamond
>> -and-
>> Avenir 45 to Gill Sans MT
>>
>> If there are other fonts in the document I want to leave them as is. I
>> am only concerned with the above 2 fonts.
>>
>> Thanks in advance for your help.
>>
>
> You don't need a macro for this. Go to Edit, Replace. On the dialog that
> appears, click More. Place the cursor in the Find What box, an click
> Format, then Font. On the dialog that appears select the font you want to
> change from, and click OK. Then position the cursor in the Replace With
> box, click Format, Font, and select the font you want to change to. Make
> sure that both the Find What and Replace With boxes have no text, then
> click Replace All.
>
> Repeat for each font you want to replace.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
>
>



Re: Conditional macro to change font by minditservices

minditservices
Wed Sep 12 21:16:48 CDT 2007

Thanks a lot fellas. I do want a macro to do this because I need to do
it to a ton of documents and want to just push a macro button. Either
way it solves my problem.

Cheers!


Re: Conditional macro to change font by Graham

Graham
Thu Sep 13 01:35:47 CDT 2007

No - the macro recorder does not store formatting information relating to
the replace function.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

m rafala wrote:
> And in case you do want a macro for this, just follow Jonathan's
> advice while using the macro recorder.
>
> "Jonathan West" <jwest@mvps.org> wrote in message
> news:e%23UbCrU9HHA.3716@TK2MSFTNGP03.phx.gbl...
>>
>> <minditservices@gmail.com> wrote in message
>> news:1189606048.406253.51660@22g2000hsm.googlegroups.com...
>>> Macro programmers -
>>>
>>> I need a macro that changes fonts in a document from:
>>> Goudy Old Style to Garamond
>>> -and-
>>> Avenir 45 to Gill Sans MT
>>>
>>> If there are other fonts in the document I want to leave them as
>>> is. I am only concerned with the above 2 fonts.
>>>
>>> Thanks in advance for your help.
>>>
>>
>> You don't need a macro for this. Go to Edit, Replace. On the dialog
>> that appears, click More. Place the cursor in the Find What box, an
>> click Format, then Font. On the dialog that appears select the font
>> you want to change from, and click OK. Then position the cursor in
>> the Replace With box, click Format, Font, and select the font you
>> want to change to. Make sure that both the Find What and Replace
>> With boxes have no text, then click Replace All.
>>
>> Repeat for each font you want to replace.
>>
>>
>> --
>> Regards
>> Jonathan West - Word MVP
>> www.intelligentdocuments.co.uk
>> Please reply to the newsgroup



Re: Conditional macro to change font by Graham

Graham
Thu Sep 13 01:53:16 CDT 2007

minditservices@gmail.com wrote:
> Thanks a lot fellas. I do want a macro to do this because I need to do
> it to a ton of documents and want to just push a macro button. Either
> way it solves my problem.
>
> Cheers!

Sub ReplaceExample()
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
'**********************
.Font.Name = "Goudy Old Style"
.Replacement.Font.Name = "Garamond"
'**********************
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.Execute replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
'**********************
.Font.Name = "Avenir 45"
.Replacement.Font.Name = "Gill Sans MT"
'**********************
.Execute replace:=wdReplaceAll
End With
End With
End Sub


should do the trick

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



Re: Conditional macro to change font by Jonathan

Jonathan
Thu Sep 13 16:04:20 CDT 2007


<minditservices@gmail.com> wrote in message
news:1189649808.000869.156760@o80g2000hse.googlegroups.com...
> Thanks a lot fellas. I do want a macro to do this because I need to do
> it to a ton of documents and want to just push a macro button. Either
> way it solves my problem.
>
> Cheers!
>

In that case, you might find this article of interest.

Find & ReplaceAll on a batch of documents in the same folder
http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



Re: Conditional macro to change font by minditservices

minditservices
Thu Sep 13 18:07:29 CDT 2007

I was about to post again because the font information is not stored
in the macro during find and replace. But Graham fixed my problem
before I even knew I had a problem. Well done Graham. I used your code
and it works perfectly.

Thanks again!


Re: Conditional macro to change font by Graham

Graham
Fri Sep 14 01:20:58 CDT 2007

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Graham Mayor wrote:
> minditservices@gmail.com wrote:
>> Thanks a lot fellas. I do want a macro to do this because I need to
>> do it to a ton of documents and want to just push a macro button.
>> Either way it solves my problem.
>>
>> Cheers!
>
> Sub ReplaceExample()
> With Selection
> .HomeKey Unit:=wdStory
> With .Find
> .ClearFormatting
> .Replacement.ClearFormatting
> .Text = ""
> .Replacement.Text = ""
> '**********************
> .Font.Name = "Goudy Old Style"
> .Replacement.Font.Name = "Garamond"
> '**********************
> .Forward = True
> .Wrap = wdFindContinue
> .Format = True
> .MatchCase = False
> .MatchWholeWord = False
> .MatchAllWordForms = False
> .MatchSoundsLike = False
> .MatchWildcards = False
> .Execute replace:=wdReplaceAll
> Selection.HomeKey Unit:=wdStory
> .ClearFormatting
> .Replacement.ClearFormatting
> .Text = ""
> .Replacement.Text = ""
> '**********************
> .Font.Name = "Avenir 45"
> .Replacement.Font.Name = "Gill Sans MT"
> '**********************
> .Execute replace:=wdReplaceAll
> End With
> End With
> End Sub
>
>
> should do the trick



Re: Conditional macro to change font by minditservices

minditservices
Tue Sep 25 16:50:29 CDT 2007

Additional snafu. We ran in to a batch of documents that have text
boxes. The macro wont change fonts inside of the text boxes or within
the footer of documents. A little more help would be much appreciated.

Thanks


Re: Conditional macro to change font by Russ

Russ
Sat Oct 06 20:35:00 PDT 2007

This article will help with the footers, etc.
http://word.mvps.org/faqs/customization/ReplaceAnywhere.htm

With text boxes you need to loop through the objects and if they are text
boxes change their default font.name property. The following macro shows a
way to do that for the main story textboxes, but if you combine it with the
ReplaceAnywhere macro, you can change all the fonts.

Dim objShape As Shape
For Each objShape In ActiveDocument.Shapes 'only in main story
With objShape
If .Type = msoTextBox Then
With .TextFrame.TextRange.Font
If .Name = "Goudy Old Style" Then
.Name = "Garamond"
ElseIf Name = "Avenir 45" Then
.Name = "Gill Sans MT"
End If
End With
End If
End With
Next objShape

> Additional snafu. We ran in to a batch of documents that have text
> boxes. The macro wont change fonts inside of the text boxes or within
> the footer of documents. A little more help would be much appreciated.
>

>> I need a macro that changes fonts in a document from:
>> Goudy Old Style to Garamond
>> -and-
>> Avenir 45 to Gill Sans MT
>>
>> If there are other fonts in the document I want to leave them as is. I
>> am only concerned with the above 2 fonts.


--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID