Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    146
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nonstandard styles (Word 2000 SR-1)

    Hi,

    I'm trying to find and remove nonstandard styles from our documents. Here is the basic code I'm using:

    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Style = ActiveDocument.Styles("Nonstandard style name.")
    Selection.Find.Execute
    If Selection.Find.Found = True Then

    MsgBox ActiveDocument.Name & " has the Nonstandard style name style."

    End If

    The macro works when the style is part of the Format > Style > All Styles list (even if it's not part of our template style set). However, when it's not in the All Styles list, an error results, stopping the macro.

    Thanks,
    Bob

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Nonstandard styles (Word 2000 SR-1)

    Build error handling into your macro. The simplest way is to put On Error Resume Next before your code, but that way you won't find out if other errors occur. More sophisticated error handling depends on what you are doing. Do you have some kind of loop?

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    146
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Nonstandard styles (Word 2000 SR-1)

    Thanks. That was exactly what I needed. I'm just plowing through a bunch of documents to find certain things. The error is just another form of "No", so I don't really need it for troubleshooting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •