Hi, I have had a working macro that search a text for a string,
then selects the other part of the same sentence and change its font
and size.
The code is as follows:
Sub mac2()
For Each myStoryRange In ActiveDocument.StoryRanges
myStoryRange.Find.Execute FindText:="%%%", Forward:=True
myStoryRange.MoveEnd Unit:=wdParagraph, Count:=1
While myStoryRange.Find.Found
myStoryRange.Font.Name = "David"
myStoryRange.Font.Size = 12
myStoryRange.Find.Execute FindText:="%%%", _
Forward:=True, Format:=True
myStoryRange.Font.Name = "Times New Roman"
myStoryRange.Font.Size = 1
myStoryRange.Find.Execute FindText:="%%%", Forward:=True
myStoryRange.MoveEnd Unit:=wdParagraph, Count:=1
Wend
Next myStoryRange
End Sub
------------------------------
The enclosed macro worked on Windows98SE / Word97. But it doesn't on
XP/Word2003.
Please help me adjust the macro so it will work on the new program.
Dave Lett - 19 Jan 2006 13:58 GMT
Hi,
Have a look at the article "Using a macro to replace text where ever it
appears in a document including Headers, Footers, Textboxes, etc." at
http://word.mvps.org/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm
Also, if your macro doesn't work, then you should explain WHAT is not
working with the macro. Otherwise, we have nothing really to go on.
HTH,
Dave
> Hi, I have had a working macro that search a text for a string,
> then selects the other part of the same sentence and change its font
[quoted text clipped - 25 lines]
>
> Please help me adjust the macro so it will work on the new program.
chook.harel@gmail.com - 20 Jan 2006 12:15 GMT
Your right, my bad.
The problem is that it can change the font but not the font size,
instead it changes it where there is several types (like Latin1 20pt)
or something like that ..
(Not the place where u usually change the size)