Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

VBA coding to delete styles

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
donna - 27 Sep 2005 21:11 GMT
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
Word Heretic - 28 Sep 2005 13:08 GMT
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
Klaus Linke - 29 Sep 2005 18:40 GMT
>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/thre
ad/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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.