Microsoft KB Archive/166702

{|
 * width="100%"|

WD: Error in Recorded Macro Using Keyboard Shortcuts

 * }

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, 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

Issue type : kbbug

Technology :