stripping unused styles 
Author Message
 stripping unused styles

I'd like to come up with code to strip unused styles out
of a Word document, and it seems like it would be simple.
I was thinking it would be something like:

Set mydoc = ActiveDocument
For Each sty In mydoc.Styles
    If sty.InUse = False Then
    Delete

But I don't quite have it right (or maybe I'm way off).
Anyone know the way to achieve this?



Wed, 20 Jul 2005 01:44:12 GMT  
 stripping unused styles
hi,

If you try to delete unused styles through code, Word will
give you an error - 'Style does not exist'

However, You can hide the unused styles by selecting
the 'Formatting in use' in the Show combobox on the
Foramtting and Styles Task Pane (Office XP) . Thus the
taskpane will show only the styles that are currently in
use. You do not need a VBA for this.

HTH

Regards,
Salonee Sawant
Business Productivity Analyst
Maestros Mediline Systems Ltd.
India.

Quote:
>-----Original Message-----
>I'd like to come up with code to strip unused styles out
>of a Word document, and it seems like it would be simple.
>I was thinking it would be something like:

>Set mydoc = ActiveDocument
>For Each sty In mydoc.Styles
>    If sty.InUse = False Then
>    Delete

>But I don't quite have it right (or maybe I'm way off).
>Anyone know the way to achieve this?
>.



Wed, 20 Jul 2005 18:24:11 GMT  
 stripping unused styles
Salonee,

I'd like to do the same thing, but I'm working in Word 97 where there
doesn't appear to be a setting to view only styles in use. I'd be satisfied
if I could delete all the non-required styles since the only style in use
will be the Normal style.

Bob Dukes


hi,

If you try to delete unused styles through code, Word will
give you an error - 'Style does not exist'

However, You can hide the unused styles by selecting
the 'Formatting in use' in the Show combobox on the
Foramtting and Styles Task Pane (Office XP) . Thus the
taskpane will show only the styles that are currently in
use. You do not need a VBA for this.

HTH

Regards,
Salonee Sawant
Business Productivity Analyst
Maestros Mediline Systems Ltd.
India.

Quote:
>-----Original Message-----
>I'd like to come up with code to strip unused styles out
>of a Word document, and it seems like it would be simple.
>I was thinking it would be something like:

>Set mydoc = ActiveDocument
>For Each sty In mydoc.Styles
>    If sty.InUse = False Then
>    Delete

>But I don't quite have it right (or maybe I'm way off).
>Anyone know the way to achieve this?
>.



Tue, 06 Sep 2005 04:51:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Stripping unused Form/Report modules

2. removing unused built in styles from list

3. Deleting unused styles

4. Macro for Removing Unused Styles

5. automatic delete unused styles?

6. Remove Unused Styles

7. scanning for existence of a style and saying what the style is

8. Customising behaviour of styles in Styles combobox

9. Working with Styles - Finding occurences of specific Styles

10. Browse a document style after style.

11. "Delete unused styles" - macro, last seen around 1998

12. Replacing all paragraph marks in a certain style EXCEPT the last one in this style

 

 
Powered by phpBB® Forum Software