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

Re: VBA coding to delete styles by Word

Word
Wed Sep 28 07:18:45 CDT 2005

G'day "donna" <donna@discussions.microsoft.com>,

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:

>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


Re: VBA coding to delete styles by Klaus

Klaus
Thu Sep 29 12:40:21 CDT 2005

"donna" wrote:
>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/microsoft.public.word.vba.general/browse_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