Re: Finding character styles in Word with VBA

Subject: Re: Finding character styles in Word with VBA
From: "Edwin Skau" <eddy -dot- skau -at- gmail -dot- com>
To: "Partridge, Robert" <Robert -dot- Partridge -at- au -dot- unisys -dot- com>
Date: Wed, 22 Mar 2006 10:47:35 +0530

Have you tried using wildcards ( ? or * )?.

Edwin

On 3/22/06, Partridge, Robert <Robert -dot- Partridge -at- au -dot- unisys -dot- com> wrote:
>
> Hi Guys,
>
> Calling all Word VBA gurus... I'm trying to find both para and char
> formats and replace them with other formats in Word XP. I've got an
> array of the find styles and another of the replace styles. Finding and
> replacing para formats is easy with this code:
>
> For i = 0 To 8
> Selection.Find.Style = ActiveDocument.styles(mystyles(i))
> Selection.Find.Replacement.Style =
> ActiveDocument.styles(replacementstyles(i))
> With Selection.Find
> .Text = "^p"
> .Replacement.Text = "^p"
> End With
> Selection.Find.Execute Replace:=wdReplaceAll
> Next i
>
> What I can't seem to do is find character styles using the same method.
> So I've got a sentence like:
>
> [style a]Something here [style b] and some more text in here[end style
> b] and back to the original style.[end style a]
>
> Is there any way to find style b and replace with style a with vba? I
> tried using empty find and replace strings or using find any character
> (^?) and replace with the find text (^&) but they don't work. I can find
> the characteristics of Style B (font color = aqua and text = hidden) and
> replace them with the normal characteristics, but I'd still have the
> different character style peppered throughout the document.
>
> Can anyone help?
>
> Cheers,
>
> Rob
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> WebWorks ePublisher Pro for Word features support for every major Help
> format plus PDF, HTML and more. Flexible, precise, and efficient content
> delivery. Try it today!. http://www.webworks.com/techwr-l
>
> Doc-To-Help includes a one-click RoboHelp project converter. It's that
> easy. Watch the demo at http://www.componentone.com/TECHWRL/DocToHelp2005
>
> ---
> You are currently subscribed to TECHWR-L as eddy -dot- skau -at- gmail -dot- com -dot-
>
> To unsubscribe send a blank email to
> techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
> or visit
> http://lists.techwr-l.com/mailman/options/techwr-l/eddy.skau%40gmail.com
>
> To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com
>
> Send administrative questions to lisa -at- techwr-l -dot- com -dot- Visit
> http://www.techwr-l.com/techwhirl/ for more resources and info.
>
>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

WebWorks ePublisher Pro for Word features support for every major Help
format plus PDF, HTML and more. Flexible, precise, and efficient content
delivery. Try it today!. http://www.webworks.com/techwr-l

Doc-To-Help includes a one-click RoboHelp project converter. It's that easy. Watch the demo at http://www.componentone.com/TECHWRL/DocToHelp2005

---
You are currently subscribed to TECHWR-L as archive -at- infoinfocus -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit http://lists.techwr-l.com/mailman/options/techwr-l/archive%40infoinfocus.com

To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com

Send administrative questions to lisa -at- techwr-l -dot- com -dot- Visit
http://www.techwr-l.com/techwhirl/ for more resources and info.


References:
Finding character styles in Word with VBA: From: Partridge, Robert

Previous by Author: Re: How to find alternative tools
Next by Author: Re: Interesting book on Management Consulting
Previous by Thread: Finding character styles in Word with VBA
Next by Thread: Finding character styles in Word with VBA?


What this post helpful? Share it with friends and colleagues:


Sponsored Ads