XL5: Custom Menu Commands Displayed in Incorrect Order
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 INFORMATIONSteps to Reproduce the Problem
To set up the custom menus:
- In a new Visual Basic module, choose Menu Editor from the Tools menu.
- 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.
- Choose the Insert button.
A new menu bar is created (New Menu Bar1).
- In the Menus box, select (End of menu bar), and choose Insert.
- In the Caption box, type Test Menu and
select (End of menu bar).
To insert the menu items:
- In the Menus Box, select Test Menu.
- In the Menu Items box, select (End of menu), and choose the Insert
button.
- In the Caption box, type Constants, and
under Menu Items, select (End of menu).
- 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:
- Under Menu Items, select Constants, and under Submenu Items,
select (End of submenu).
- Choose Insert.
- In the Caption box, type Errors.
- Select "(End of submenu)".
- Repeat steps 2 through 4 to create the following additional submenu
items (substitute the following items for the word "Errors" in step 3):
Text
Number
- Under Menu Items, select Formulas, and under Submenu Items, select (End
of submenu).
- Repeat steps 2-6 to add submenu items to the Formulas menu.
- Choose OK to close the Menu Editor.
To display the menus:
- On the module sheet, type the following:
Sub MyMenu()
MenuBars("New Menu Bar1").Activate
End Sub
- Choose Macro from the Tools menu.
- 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:
editor
Keywords : kbprg
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :
|