I have read many of the responses and tried solutions, but so far have
not been able to crack my problem.
I have older files that need to be edited and sent off. They have the
old Char Char problem. The style I'm concerned with is a created
style "Main Body Text" and its mutations Main Body Text Char Char,
Char Char Char Char, Char Char Char Char Char Char Char Char, and so
forth.
At present I search for these mutations and replace them manually with
"Main Body Text" - they are not linked so that is easy. Then
delete them manually. Problem is some documents have so many it takes
for ever.
If only I had a macro that would find all occurrences of the style
"Main Body Text Char *" and replaced it with "Main Body Text" I
tried the following macro but it does pick them up.
Any ideas?
Many thanks,
Mark
Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Main Body Text Char
*")
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Main Body
Text")
Cindy M -WordMVP- - 21 Jan 2005 17:33 GMT
Hi Mark,
> I
> tried the following macro but it does pick them up.
The * wildcard won't work when searching a style name in a
document. You'd need to search each style, individually.
What you could perhaps do is use a For Each loop to check
the presence of the basic style and Char in each style's
name. Roughly, like this (untested)
For each styl in ActiveDocument.Styles
s = styl.LocalName
If Instr(s, "Char") <> 0 Then
If Instr(s, "Main text") <> 0 Then
'Find/Replace using s
End If
End If
Next
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
Mark K - 22 Jan 2005 04:08 GMT
Many thanks, I'll give it a try.
Mark
Mark K - 22 Jan 2005 05:45 GMT
Cindy
I gave it a go, but can't get it to work. The find replace bit has me
stumpted as to what I should do.
Mark
Klaus Linke - 21 Jan 2005 22:29 GMT
Besides Cindy's macro, you could check out Andrew Savikas' from here:
http://hacks.oreilly.com/pub/h/2597
I haven't tested much, but it seemed to work pretty well.
Regards,
Klaus
Mark K - 22 Jan 2005 04:10 GMT
Hi
Thanks
Yes, I have tried and retried this macro/function. But, on my PC Word
stops responding when I use it. I've had a bit of a look at what its is
doing, but cannot see why it would lock up.
Mark