VBA coding to delete styles

D

donna

I want to delete all styles from the active document and copy new styles from
another(xyz.dot) template.

What will be the coding?

Thanks
 
W

Word Heretic

G'day "donna" <[email protected]>,

Usually people want to map old styles to new styles. www.editorium.com
sells megareplacer to do just that really easily and really cheaply.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


donna reckoned:
 
K

Klaus Linke

donna said:
I want to delete all styles from the active document and copy
new styles from another(xyz.dot) template.

What will be the coding?


Hi Donna,

You don't want to delete all styles, since the text would revert to Normal
style.
Copy the styles from the template to the doc, then delete unused styles.

For the second part, you can find macros such as the one from
http://groups.google.com/group/micr..._frm/thread/40cb22fdea5c5627/2cf2810d6d94d7b4

If you don't want to confirm all the deletions manually, change the "If
..Found = False Then ... End If" to

If .Found = False Then
If myStyle.LinkStyle <> ActiveDocument.Styles(wdStyleNormal) Then
myStyle.LinkStyle = ActiveDocument.Styles(wdStyleNormal)
End If
myStyle.Delete
End If

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