WD97: Run-Time Error 1517 Running Converted Wordbasic Macro

Last reviewed: February 11, 1998
Article ID: Q163098
The information in this article applies to:
  • Microsoft Word 97 for Windows

SYMPTOMS

When you run a converted WordBasic macro you receive the following error message:

   Run-time error '1517':
   Word cannot find the designated menu item.

CAUSE

The converted macro contains a command that is missing arguments.

WORKAROUND

Use one of the following methods to work around this problem:

Method 1: Record the menu action in WordBasic

Using the version of Word that you used to create the original WordBasic macro, record the actions to perform the menu function, and then convert it to a Visual Basic for Applications macro.

Method 2: Convert the code to Visual Basic for Applications commands

Edit the converted macro in the Visual Basic Editor and replace the WordBasic commands with Visual Basic for Applications commands.

For example, change this converted WordBasic command line,

   WordBasic.ToolsCustomizeMenus Name:="MySubMenu", Context:=1, _
   Menu:="MyMenu", Remove:=1

to this Visual Basic for Applications command set:

   Dim objMenuBar As Object
   Set objMenuBar = CommandBars.ActiveMenuBar.Controls("MyMenu"). _
      CommandBar
   objMenuBar.Controls("MySubMenu").Delete

For more information about CommandBars, from the Visual Basic for Applications Editor, click the Office Assistant, type "CommandBars," click Search, and then click to view "CommandBar Object."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Visual Basic Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component


Additional query words: 97
Keywords : kbwordvba kbmacro kbusage
Version : 97
Platform : WINDOWS


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 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.