PDA

View Full Version : Solved: Word Styles



ABrown
05-16-2008, 03:37 AM
Is there a way I can move through a word document, using the find and find next for all styles. I don't know what they will be called in a document so therefore cannot use style names, I have tried the wdBrowseHeading but they just takes me through the heading styles. Is there a way to start at the top of the document and go to the next style?? I have a form whereby I want the user to move to the next style and then pick from the form what style they want to apply. It is all working except that I can't browse to the next style. I did have a list box populated with all the styles in the document and on click it moved them to that style, but I wanted something a little simpler??

Any one know how I can do this?

Many thanks in advance.

Annette:banghead:

EricFletcher
05-16-2008, 05:55 AM
First, every paragraph has a style whether it is assigned explicitly or not. Usually it is the Normal style, but it could be any style because the "next style" is typically set to be the same as the previous one.

Can you clarify what you want to do? Do you want to find the next instance of a style that is not the same as the current one? Or, one in a given list?

Depending on what you are wanting to do, you may be able to use a non-VBA approach for this. Open the Task Pane's Styles and Formatting panel (Word 2003), you can have it Show all styles (or formatting) in effect. When you then right click an item in the list presented, one option is to Select all instances: when selected, you can then click on the name of the style you want applied to all such instances. This is a handy way to rationalize formatting in a Word document, but I don't think it would be a task for VBA code.

ABrown
05-16-2008, 06:24 AM
Thanks Eric, I think I have resolved my problem and yes, I was approaching it the wrong way. Thank you for the time in replying.

Regards.

Annette