Article ID: 107689 - View products that this article applies to.
This article was previously published under Q107689
You can use the Microsoft Windows Dynamic Link Libraries (DLLs) to disable the commands in the Microsoft Excel Control menu. For example, you can use these tools to delete the Minimize and Maximize buttons.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. Microsoft Excel does not have the built-in functionality to modify the Control menu commands. However, you can use the Declare statement in a Visual Basic procedure to call Microsoft Windows functions to disable and restore Control menu items.
The following sample Visual Basic procedure, Disable_Control, disables the entire Control menu in Microsoft Excel. The macro disables the Control menu for the current session of Microsoft Excel (when you restart Microsoft Excel the Control menu will be reset). The procedure RestoreSystemMenu restores the Control menu.
Microsoft Excel Version 97 and 7.0
Microsoft Excel version 5.x
NotesThe commands on the control menu are numbered starting at zero. The default control menu items are as follows: Control Menu Restore is item 0, Move is item 1, Size is item 2, and so on. Even if items are deleted, the first item always starts at zero.
To delete individual items from the control menu without deleting the entire menu, you can specify the menu command to delete. For example the following two lines of code when used in place of the For Next loop in the procedure Disable_Control above, will delete the Maximize (item 4) and Minimize (item 3) commands and disable the Maximize and Minimize buttons.
Article ID: 107689 - Last Review: June 11, 2007 - Revision: 2.3
Contact us for more help
Connect with Answer Desk for expert help.