XL5: Custom Menu Commands Displayed in Incorrect Order

Last reviewed: September 2, 1997
Article ID: Q115697
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

When you use the Menu Editor tool to customize your menus, adjacent menus that contain submenu items may not be displayed in the order in which they were created.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.

WORKAROUND

To work around this problem, do either of the following:

  • Put a separator ("-") between the menu commands that contain submenu items, or place a menu item that doesn't have submenu items between the menu commands that do contain submenu items.

    -or-

  • Use a Visual Basic, Applications Edition, procedure to create the new menus (rather than using the Menu Editor).

MORE INFORMATION

Steps to Reproduce the Problem

To set up the custom menus:

  1. In a new Visual Basic module, choose Menu Editor from the Tools menu.

  2. In the Menu Bars box, choose any menu bar from the list.

    You should see the name of the menu bar repeated in the Caption box.

  3. Choose the Insert button.

    A new menu bar is created (New Menu Bar1).

  4. In the Menus box, select (End of menu bar), and choose Insert.

  5. In the Caption box, type "Test Menu" (without the quotation marks) and select (End of menu bar).

To insert the menu items:

  1. In the Menus Box, select Test Menu.

  2. In the Menu Items box, select (End of menu), and choose the Insert button.

  3. In the Caption box, type "Constants" (without the quotation marks), and under Menu Items, select (End of menu).

  4. Repeat steps 2 through 3 to create the following additional menu items (substitute the following items for the word "Constants" in step 3):

          Formulas
          -
          Hello
    

To insert the submenu items:

  1. Under Menu Items, select Constants, and under Submenu Items, select (End of submenu).

  2. Choose Insert.

  3. In the Caption box, type "Errors" without the quotation marks.

  4. Select "(End of submenu)".

  5. Repeat steps 2 through 4 to create the following additional submenu items (substitute the following items for the word "Errors" in step 3):

          Text
          Numbers
    

  6. Under Menu Items, select Formulas, and under Submenu Items, select (End of submenu).

  7. Repeat steps 2-6 to add submenu items to the Formulas menu.

  8. Choose OK to close the Menu Editor.

To display the menus:

  1. On the module sheet, type the following:

          Sub MyMenu()
             MenuBars("New Menu Bar1").Activate
          End Sub
    
    

  2. Choose Macro from the Tools menu.

  3. Select "MyMenu" from the list of macros, and choose Run.

The resulting menu items in the Select menu are: Formulas, <separator>, Hello, Constants. Constants should be first with Formulas directly beneath it.

To reset the menu bar to the default module menu bar, create and run the following macro:

   Sub newmenu()
      MenuBars(xlModule).Activate
   End Sub

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line- continuation character. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."

REFERENCES

"Visual Basic User's Guide," version 5.0, Chapter 12, "Menus and Toolbars"

For more information about Menu Editor command (Tools menu), choose the Search button in Help for Visual Basic and type:

   menu bars


Additional query words: 5.00 editor
Keywords : kbprg PgmOthr kbprg
Version : 5.00
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: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.