The information in this article applies to:
SYMPTOMS
When you run a macro that attempts to set the Enabled property for a built-
in menu command or a submenu command, you receive an error message.
In Microsoft Excel 5.0 and 7.0, you receive the following error message:
CAUSEIn Microsoft Excel, you cannot enable or disable built-in menu commands and submenu commands. You can only set the Enabled property for a menu command that you add to a menu. RESOLUTIONMicrosoft provides programming examples 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp Simulating Disabling a Built-in Menu CommandYou cannot enable or disable a built-in menu command. However, you can create a macro that gives a built-in menu command the appearance of being disabled.The sample macro in this article "disables" the built-in Exit menu command on the File menu. This macro performs the following steps:
Sample Macro
Resetting the Menu That Is Changed by the Sample MacroTo reset the entire menu to the default values, run the following macro:
NOTE: There is not a way to reset a single menu or menu command.
MORE INFORMATIONSTATUSThis behavior is by design of the programs listed at the beginning of this article. REFERENCESFor additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base: Q163435 VBA: Programming Resources for Visual Basic for Applications Additional query words: xl97 7.00a 5.00c submenu
Keywords : kbprg kbui kbdta kbdtacode xlui IntpMenu KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |