WD: Error in Recorded Macro Using Keyboard Shortcuts

Last reviewed: February 3, 1998
Article ID: Q166702
The information in this article applies to:
  • Microsoft Word for Windows, version 6.0
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

SYMPTOMS

When you record a WordBasic macro to apply a style using a user-defined keyboard shortcut, playing back the recorded macro may return the following error:

   Error 509: Command not available.

CAUSE

When the macro is recorded, the following line is added after the command that applies the style:

   Unrecognized_Statement101

The macro resembles the following:

   Sub MAIN
      Style "Style1"
      Unrecognized_Statement101
   End Sub

This "Unrecognized_Statement101" line is not a valid WordBasic statement. When you attempt to run the recorded macro, the macro fails on this line and you receive the error message.

WORKAROUND

To work around this problem, follow these steps to edit the macro:

  1. On the Tools menu, click Macros.

  2. In the list of available macros, select the macro you recorded.

  3. Click Edit.

  4. In the macro editor window, select the "Unrecognized_Statement101" line.

  5. On your keyboard, press DELETE.

  6. On the File menu, click Close.

  7. Click Yes to save changes to your macro.

To record a macro that applies a style, begin recording the macro, and then use either of the following methods.

Method 1: Select a Style Using the Style Menu

To select a style using the Style menu, follow these steps:

  1. On the Format menu, click Style.

  2. From the Styles box, select the style.

  3. Click OK.

Method 2: Select a Style Using the Style Box on the Formatting Toolbar

To select a style using the Style box on the Formatting Toolbar, follow these steps:

  1. On the Formatting toolbar, click the drop-down arrow next to the Style box.

  2. Select the style you want to use from the list of styles.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional Query Words:

Keywords          : kberrmsg kbmacro kbprg
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbbug
Solution Type     : kbworkaround


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.