Generating Styles

J

Jerry Krinock

Generating and cloning styles in Word X is SO time-consuming, going through
the hierarchy of dialog boxes.

For example, I want to generate 9 different "outline level" styles which
will all be similar to one another, except have a different indentation.
Arghhh!!! It's going to take me 20 minutes.

Does anyone know a way to generate and clone styles using a spreadsheet-type
of entry format? Or maybe to import them as a text file? Are there any VBA
tricks which might help?

Jerry Krinock
San Jose, CA USA
 
J

John McGhie [MVP]

Hi Jerry:

from "Jerry said:
Generating and cloning styles in Word X is SO time-consuming, going through
the hierarchy of dialog boxes.

Yeah, tell me about it :) Word 6 for DOS was the last one that enabled
table-entry of style parameters. Various people have macros that will do
it, but they charge for them. We have been requesting a return of this
feature for some years, without success :)
For example, I want to generate 9 different "outline level" styles which
will all be similar to one another, except have a different indentation.
Arghhh!!! It's going to take me 20 minutes.

Now, maybe this is a good time for a note of caution. If your "Outline"
styles are NOT the "built-in" Heading 1 through Heading 9 styles, you will
get constant grief. Nothing about your formatting or numbering will ever be
reliable.

So make a Design Decision now: USE the built-in Heading styles :) You can
customize them within an inch of their lives: you can format them any way
you want. But use the built-in styles.

Or you can spend the next two years suffering constant grief and crashes and
corruptions and inconsistent formatting. And then you can make a decision
to adopt the built-in styles :)

Sorry mate, I've been doing this since 1973: I know this road well :)
Does anyone know a way to generate and clone styles using a spreadsheet-type
of entry format? Or maybe to import them as a text file? Are there any VBA
tricks which might help?

Yes. If all you want to do is copy style definitions to a different
document or template, you can use the Organizer tool to do that. The
instructions are in the help. Note that to copy numbering, you must copy
the style TWICE without moving your selection. To copy an Outline list, you
must copy all NINE styles at once, twice, without moving your selection.
Otherwise you do not bring in the list template.

To make a tool to define styles, while you are spending the 20 minutes, turn
your Macro Recorder on. Don't worry about getting the definitions
"correct", you can fix them later. Just make sure that you make "a change"
in each section of the dialog for each style. When you have finished, stop
the recorder and save the result. You now have a text file that will define
all of your styles perfectly.

You can edit this file in the VBA editor, or you can export it as a text
file and edit it in any other text editor you choose. When you edit it
externally, or export it for use on another computer, you can import it to
the VBA editor. The file name must have the extension ".bas" for the VBA
editor to recognise it (because it's a text file, it MUST have an
extension).

To make a new set of styles, simply copy and edit the macro you just
recorded.

Be careful of the order in which you do things: Define the styles first,
ensure you define the numbering second, and ensure that you define an
associated style for each level of numbering. Otherwise the macro will run
VERY slowly on a large (greater than 1,000 pages...) document.

What I have given you here is a very superficial overview :) Stay close to
this group and we'll be delighted to give you the rest of it. In the
meantime, read everything you can in the Word Help: it's the only complete
and up-to-date set of documentation there is for Word. Then read everything
you can at www.mvps.org/word. Ignore the fact that most of the stuff there
is about PC Word: the only material differences are that Mac Word does not
have full Unicode, or some of the VBA commands that PC Word has.

Hope this helps

--
All Spam and attachments blocked by Microsoft Entourage for Mac OS X. Please
post replies to the newsgroup to maintain the thread.

John McGhie, Microsoft MVP: Word for Macintosh and Word for Windows
Consultant Technical Writer <[email protected]>
+61 4 1209 1410; Sydney, Australia: GMT + 10 hrs
 
J

Jerry Krinock

Thanks, John...I understand most of what you said.....

So make a Design Decision now: USE the built-in Heading styles :) You can
customize them within an inch of their lives: you can format them any way
you want. But use the built-in styles.
Fortunately, that's what I usually do.
Note that to copy numbering, you must copy
the style TWICE without moving your selection.

I think this explains why, on occasion, I have wanted to do serious physical
damage to the Style Organizer. Is that a bug or a feature :( ????
To copy an Outline list, you
must copy all NINE styles at once, twice, without moving your selection.
Otherwise you do not bring in the list template.
that was way over my head, but I don't think I need it
To make a tool to define styles...

this will be real fun.
To make a new set of styles, simply copy and edit the macro you just
recorded.

Be careful of the order in which you do things: Define the styles first,
ensure you define the numbering second, and ensure that you define an
associated style for each level of numbering. Otherwise the macro will run
VERY slowly on a large (greater than 1,000 pages...) document.
Here's a related tip: I have noticed that, when changing style parameters
using the dialogs, if I change the Numbering, it thoughtfully goes and
resets the Paragraph Margins to zero. Arghhhhhh!!!
What I have given you here is a very superficial overview :) ...

Thanks, again.
 
J

John McGhie [MVP]

Hi Jerry:

from "Jerry said:
I think this explains why, on occasion, I have wanted to do serious physical
damage to the Style Organizer. Is that a bug or a feature :( ????

Depends who you ask. To me, it's a BUG!! To Microsoft, it's a safety
feature :)

Word numbering is produced by adding a reference from a style to a property
container named a "List Template". Unless you are in the VBA editor, you
will never see any list templates nor be able to read the help on them.
They are not a user-level feature.

However, just thing of a list template as a table containing all the
properties that define numbering. There can be more than 200 list templates
in a document, and only a few (usually about five) will actually be in use.

The List Template is the most critical component of numbering, and as such
is treated as a highly-valuable resource. Word thus protects it from being
overwritten.

Because up to half the text can be linked to it!

But what *I* want is for the style to bring in its associated list template,
every time!

Here's a related tip: I have noticed that, when changing style parameters
using the dialogs, if I change the Numbering, it thoughtfully goes and
resets the Paragraph Margins to zero. Arghhhhhh!!!

Whenever you redefine numbering, it resets the indents. That's a bug. You
need to go back and reset the paragraph properties each time. However, if
you use Format>Style>Modify>Format>Numbering, it won't happen, because you
are then defining the numbering as part of the style.

BTW: Whenever you copy any paragraph style with numbering, you ARE copying
an Outline, whether you think it is or not. So you need to copy all nine
styles each time. Twice.

Cheers

--
All Spam and attachments blocked by Microsoft Entourage for Mac OS X. Please
post replies to the newsgroup to maintain the thread.

John McGhie, Microsoft MVP: Word for Macintosh and Word for Windows
Consultant Technical Writer <[email protected]>
+61 4 1209 1410; Sydney, Australia: GMT + 10 hrs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top