Change name of style

D

dbranthwaite

I would like to change the name of several custom styles in a document
and also make sure that it is reflected in the document. What would be
the best way to accomplish this task.

For example - CustomStyle1 is used in 5 places and CustomStyle2 is
used in 4 places in the doc. I would like to have them changed to CS1
and CS2 and ensure we have maintained the styles within the document.

Regards,

Don
 
S

Shauna Kelly

Hi Don


Have you tried to do this? If so, what went wrong?

The VBA help on this says that the .NameLocal property of a Style
"Returns the name of a built-in style in the language of the user.
Setting this property renames a user-defined style or adds an alias to a
built-in style. Read/write String."

So this tells you how to re-name a style:
ActiveDocument.Styles("OldStyle").NameLocal = "NewStyle"

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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