How to delete unused styles - Macro?

B

Bothell writer

Does someone have a macro to delete unused styles THAT WORKS? I'm trying to
delete styles that show up under Available Styles in my document's Styles and
Formatting pane, but that don't exist in the template attached to the
document.

As we know, it's very difficult to eliminate styles that were defined for or
existed in the document at one time. I've deleted them from the template;
I've deleted them several times from the document, and I've deleted them
using the Templates and Add-Ins Organizer. Nothing works.

I tried one macro that I found on the web, but it parsed all 150 styles,
switching between Keep and Delete and then crashed. I'd rather not have one
that so confusingly bounces between positive and negative queries. I tried
another macro, got runtime errors, and couldn't debug.

Any help is appreciated. Quick responses, in particular!
Thanks.
 
B

Bothell writer

I'm running WORD 2003.

It was Klaus Linke's macro that crashed after going through about 70
Keep/Delete prompts for my style names through the letter L. The line it
crashed on, according to the debugger was the myStyle.Delete portion of the
following line:
Else
If MsgBox("Keep?", vbYesNo, myStyle.NameLocal) = vbNo Then
myStyle.Delete
 
B

Bothell writer

Thanks, Ron. Thankfully, it didn't return any runtime errors and I was able
to remove the offending styles. I'm hoping they stay away!
 
J

J Weir

I am using Word 2007 - would this work?

If so how do you activate it?

If not, is there something else?
 
S

Stefan Blom

To load the template as an add-in in Word 2007: Office button | Word
Options, Add-Ins category. For "Manage," choose "Templates," and click Go.
In the dialog box, click the Add button and navigate to the file. Click OK
twice. Now you will find the Scan Document Styles button on the Add-Ins tab
on the ribbon. Just click it to run the style report.

--
Stefan Blom
Microsoft Word MVP


in message
 
J

J Weir

Thanks - it works on some smaller documents but has crashed Word on my larger
documents.

Do you any further advice? Thanks
 
S

Stefan Blom

Sorry, I don't know what could be causing the problem. Perhaps one of the
creators of the macro, Greg Maxey or Klaus Linke, knows?

--
Stefan Blom
Microsoft Word MVP


in message
 

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