PDA

View Full Version : Macro to assign styles?


Stacey
April 27th, 2004, 02:53 PM
Is it possible to write a macro in Word 2000 to assign
styles in a document? For example, if a client gives me an
unformatted document and I want to assign "Header 1" to
every line that's 14pt/all caps/bold italic/12 points
after/keep with next, "Header 2" to every line that's
12pt/u&lc/bold/6 points after, etc., is that possible? Any
tips to automate formatting super-long documents are
helpful. I spend an inordinate amount of time clicking the
cursor on a line and assigning a style...even with a
keyboard shortcut, it takes a long time.

Charles Kenyon
April 27th, 2004, 04:00 PM
This may be a reason to upgrade to Word 2003. This can be done with a macro,
but what if the formatting misses one of your criteria such as "keep with
next?"

Otherwise, you could use replace to replace the formatting with a style.

--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Stacey" > wrote in message
...
> Is it possible to write a macro in Word 2000 to assign
> styles in a document? For example, if a client gives me an
> unformatted document and I want to assign "Header 1" to
> every line that's 14pt/all caps/bold italic/12 points
> after/keep with next, "Header 2" to every line that's
> 12pt/u&lc/bold/6 points after, etc., is that possible? Any
> tips to automate formatting super-long documents are
> helpful. I spend an inordinate amount of time clicking the
> cursor on a line and assigning a style...even with a
> keyboard shortcut, it takes a long time.

Suzanne S. Barnhill
April 27th, 2004, 04:04 PM
You can use Find and Replace to search for specific formatting and replace
it with a specific style. If you had Word 2002 or above, it would be even
easier, as later versions allow you to select all instances of specific
formatting.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Stacey" > wrote in message
...
> Is it possible to write a macro in Word 2000 to assign
> styles in a document? For example, if a client gives me an
> unformatted document and I want to assign "Header 1" to
> every line that's 14pt/all caps/bold italic/12 points
> after/keep with next, "Header 2" to every line that's
> 12pt/u&lc/bold/6 points after, etc., is that possible? Any
> tips to automate formatting super-long documents are
> helpful. I spend an inordinate amount of time clicking the
> cursor on a line and assigning a style...even with a
> keyboard shortcut, it takes a long time.

Clive Huggan
April 28th, 2004, 04:09 AM
Stacey,

Suzanne's and Charles's advice gives the most efficient approach. My comment
relates to when I'm down to the last "unfixable" instances and applying a
style manually is unavoidable: I find that once I have applied a particular
style, it's easy to re-do the last action by hitting the F4 key (or Ctrl-y)
than to re-key the style with its particular keyboard shortcut.

Clive Huggan
Canberra, Australia
===================

in article , Suzanne S. Barnhill at
wrote on 28/4/04 1:04 AM:

> You can use Find and Replace to search for specific formatting and replace
> it with a specific style. If you had Word 2002 or above, it would be even
> easier, as later versions allow you to select all instances of specific
> formatting.
>
> --
> Suzanne S. Barnhill
> Microsoft MVP (Word)
> Words into Type
> Fairhope, Alabama USA
> Word MVP FAQ site: http://www.word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so
> all may benefit.
>
> "Stacey" > wrote in message
> ...
>> Is it possible to write a macro in Word 2000 to assign
>> styles in a document? For example, if a client gives me an
>> unformatted document and I want to assign "Header 1" to
>> every line that's 14pt/all caps/bold italic/12 points
>> after/keep with next, "Header 2" to every line that's
>> 12pt/u&lc/bold/6 points after, etc., is that possible? Any
>> tips to automate formatting super-long documents are
>> helpful. I spend an inordinate amount of time clicking the
>> cursor on a line and assigning a style...even with a
>> keyboard shortcut, it takes a long time.
>

Google