Re: Changing Styles by Word
Word
Fri Jan 07 20:03:50 CST 2005
G'day "Vince" <sdsad@fsd.com>,
Well, I'm glad my 30 seconds was worth it then :-)
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Vince reckoned:
>Steve,
>
>And I spent two hours on that!!! Don't believe it!
>
>Thanks a lot, needless to say, it works fine!
>
>Vince
>
>"Word Heretic" <myfullname@tpg.com.au> wrote in message
>news:qpbst0dm3f7huva2an0ergrec28fuak9gs@4ax.com...
>> G'day "Vince" <sdsad@fsd.com>,
>>
>> I'd structure it more like
>>
>> >With ActiveDocument.Range.Find
>> > .ClearFormatting
>> > .MatchWildcards = False
>> > .Style = "COOL"
>> > With .Replacement
>> > .Style = "NOTSOCOOL"
>> > End With
>> >
>> > .Execute Replace:=wdReplaceAll
>> >End With
>>
>> but also, does the NOTSOCOOL style EXIST? Styles.Add "NOTSOCOOL"
>> first, and do an on error resume next
>>
>> Steve Hudson - Word Heretic
>>
>> steve from wordheretic.com (Email replies require payment)
>> Without prejudice
>>
>>
>> Vince reckoned:
>>
>> >
>> >This is crazy. I am trying to change the style "COOL" in the document to
>> >another style called "NOTSOCOOL". I wrote this:
>> >
>> >With ActiveDocument.Range.Find
>> > .Style = "COOL"
>> > .ClearFormatting
>> > .MatchWildcards = False
>> >
>> > With .Replacement
>> > .Style = "NOTSOCOOL"
>> > End With
>> >
>> > .Execute Replace:=wdReplaceAll
>> >End With
>> >
>> >
>> >Doesn't work! I am positive that nothing extra is set, the same code
>(when
>> >.style is removed and .text is added) finds and replaces words with no
>> >problems. The styles definitely exist and I did a manual Find and Replace
>> >(Edit - Find) and it works fine.
>> >
>> >What's wrong with the code?
>> >
>> >Thank you for your time / response
>> >
>> >Vince
>> >
>>
>