Word - Update styles from macro code - Numbering fails to update?

K

Kenny Bones

Hi, I remember seing something about this some time ago. Someone at these
forums I think mentioned that there's a bug in Word 2003 or something which
causes the numbering of styles to fail when styles are updated from one
document to another?

I just found out, I've got this macro containing only a single line of code
which updates the styles from one template over to the other. Everything
works, except a style which has numbering enabled on it. I've got two styles,
one style with bullets, and one with plain numbering. The style with
numbering somehow get attached to the bullet style, only with an extra
indention.

Any idea how to overcome this bug?

Btw: My macro looks like this:
AppWord.ActiveDocument.CopyStylesFromTemplate("template.doc")
 
G

Gordon Bentley-Mix

It's been a while since I looked at this, so I'm working from memory here -
and considering the current state of my memory... ;-)

The problem with numbering occurs because Word doesn't quite explicitly
define the numbering associated with a Style. Rather it just references the
List Gallery entry and draws the necessary information from the entry. Of
course, if the numbering definition specified by the gallery entry doesn't
match that of the "source", the numbering on the Style gets stuffed.

The solution, if memory serves, is to define the numbering explicitly when
copying the Style. Unfortunately, I don't have the code for doing this
immediately to hand; it's buried in my archives somewhere. However, to get
started, take a look at the VBA help on ListGalleries. If I have time -
doubtful at this point considering my workload - I'll try to dig out my old
code and post a bit of it as well.
--
Cheers!

Gordon Bentley-Mix
Word MVP

UNSOLICITED EMAIL CONTACT WILL BE MARKED AS SPAM AND DELETED! Please post
all follow-ups to the newsgroup.

Read the original version of this post in the Office Discussion Groups - no
membership required!
 
K

Klaus Linke

Another popular tip is to copy the numbered styles three times for luck.

Can't guarantee it works... but it may be worth a try.

Regards,
Klaus
 

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