PDA

View Full Version : Finding Styles Macro??



FinancialAnalystKid
01-13-2005, 09:23 AM
If I have a style titled "FORMAT1" is it possible that a Macro can be written to find all those styles in the document and add a "-" in front of that paragraph where the style starts?

I don't want to rename the style to "-FORMAT1" I want to 'tick' each style on the document with that style so I can search for each if needed.

Is it possible to color that paragraph a specific color as well using the macro? Although this would be possible with another Style Format I presume and a macro listed in Word's Help shows how to change one style with another. So this isn't pressing.

Thanks!

TonyJollans
01-13-2005, 11:16 AM
Certainly a macro can be written to find occurrences of styles - you can record yourself doing it manually to get one. Inserting text at the start, or colouring the paragraph would also not be a problem but I don't really understand where you want to go next. If the purpose of this is simply to enable identification could you not just change the FORMAT1 style itself? Or use Find?

FinancialAnalystKid
01-13-2005, 11:44 AM
The purpose of this is to import the whole document into another software that recognizes the "-" as a formating option. When imported, the software looks at the begining of each paragraph and if it finds a "-" then it treats it differently.

I don't want the "-" in the document unless I am exporting it to the other program because the WORD doc will also be printable.

I guess it would be the same as replacing FORMAT1 style with a new style but how would you add a "-" in front of a style?

TonyJollans
01-13-2005, 12:52 PM
You should be able to add a hyphen to each paragraph with a single Replace (record it if you want code).

In your document, Ctrl+H to bring up the Replace Dialog
Click More >> (if shown)
Leave Find what textbox empty
Click on Format, Select Style..., Choose FORMAT1 from the list, Click OK
In the Replace with box, Enter -^& (hyphen caret ampersand)
Click Replace All

FinancialAnalystKid
01-13-2005, 02:18 PM
Perfect!