The information in this article applies to:
SUMMARYThe following Visual Basic for Applications code will remove the Close command from the Document System menu list and the keyboard commands assigned to "DocClose" command. By making an item not visible, it is removed from the menu list and unavailable to users, whether the document is docked or windowed. MORE INFORMATIONMicrosoft 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/refguide/ Remove Menu ItemsTo disable the Close command or any item on the Document System menu list run the following lines of code. By making an item not visible, it is removed from the menu list and unavailable to the user, whether the document is docked or windowed on the screen.
NOTE: When you type the name of the menu item, you must type the name as it
appears in the menu list (with no spaces and the "&" representing the "hot
key").
Restore Menu itemsTo restore the system menu items, you must run the following macro.NOTE: Closing and restarting Word does not restore the menu items.
Disable Keyboard ShortcutTo disable the keyboard shortcut key assigned to the DocClose macro, run the following code:
Assign or Reset Keyboard Shortcut KeysTo assign the default values and functionality, run one of the following Visual Basic for Applications macros:
-or-
For more information about command bars, from the Visual Basic Editor,
click the Office Assistant, type Commandbars, click Search, and then
click to view "Using command bars".
For more information about customizing Templates, from the Visual Basic Editor, click the Office Assistant, type CustomizationContext, click Search, and then click to view "CustomizationContext Property". For more information about keyboard key stroke assignment, from the Visual Basic Editor, click the Office Assistant, type KeyBindings, click Search, and then click to view "KeyBindings Collection Object". NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base: Q176476 OFF: Office Assistant Not Answering Visual Basic QuestionsFor additional information, please see the following article in the Microsoft Knowledge Base: Q173707 OFF97: How to Run Sample Code from Knowledge Base Articles Additional query words: wordcon vba toolbars dialog box
Keywords : kbdta kbwordvba |
Last Reviewed: October 15, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |