The information in this article applies to:
SYMPTOM
In Microsoft Excel versions 5.x and 7.0 for Windows, the Caption property
of a Menu or a MenuItem will contain an ampersand character (&) if the Menu
or MenuItem has a quick key assigned to it. If an ampersand actually
appears in the name of the Menu or MenuItem, the Caption property for that
item will contain two ampersands right next to each other.
CAUSEThis behavior occurs because, although ampersands are used to assign quick keys to a Menu or MenuItem, they are interpreted as part of the caption text. MORE INFORMATION
When you create the Menu or MenuItem, either in a macro or by using the
Menu Editor, an ampersand is used to indicate that the next character is
the designated quick key.
Visual Basic Code ExampleMicrosoft 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."Example 1--Results of reading the Caption property of a Menu or MenuItem that has a quick key assigned to itTo run this first example, position the cursor in the line which reads "Sub GetCaptions1()" and either press the F5 key or choose Start from the Run menu.
Example 2--The results of reading the Caption property of a Menu or MenuItem that actually contains an ampersandTo run the second example, position the cursor in the line which reads "Sub GetCaptions2()" and either press the F5 key or choose Start from the Run menu.
Additional query words: 5.00c
Keywords : kbprg |
Last Reviewed: October 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |