Disabling user interface elements
You can set policies that disable menu commands, toolbar buttons, and shortcut keys. By setting these policies, you can help prevent users from changing or gaining access to particular features or options. A menu item or command bar button that has been disabled by policy appears grayed out in the user interface and is unavailable to users.
Disabling menu items and command bar buttons
A number of menu items and command bar buttons are listed by name in the policy templates in the Disable items in user interface | Predefined | Disable command bar buttons and menu items policy. These items include commands that administrators frequently choose to disable, such as the Hyperlink command (Insert menu) and the Macro command (Tools menu).
To disable any other command in an Office 2003 application, you set the Custom | Disable command bar buttons and menu items policy and add the control ID for the command you want to disable.
To disable a menu item and the corresponding command bar button
1. Select the check box to set the Custom | Disable command bar buttons and menu items policy for the appropriate Office 2003 application.
2. Click the Show button.
3. Click Add and enter the control ID for the item you want to disable.
Note Menu items and their corresponding command bar buttons share the same control ID. For example, in Microsoft Word the control ID for both the Save command (File menu) and Save button (Standard toolbar) is 3.
Finding control IDs in Visual Basic for Applications
You can look up control IDs for any item on a menu or toolbar in Office 2003 applications by using Microsoft Visual Basic® for Applications (VBA). You can either look up a single control ID or use a macro to find a series of control IDs. Then you enter the control ID into the Group Policy snap-in to disable that menu command and toolbar button.
Note Menu commands and their corresponding toolbar buttons share the same control ID. For example, the control ID for both the Save command (File menu) and the Save button (Standard toolbar) in Microsoft Word is 3.
Finding a single control ID
You use the Immediate window in VBA to look up the control ID for a single item on a menu. For example, the following command returns the value 748, which is the control ID for the Save As command on the File menu in Microsoft Word:
? commandbars("menu bar").controls("file").controls("save as...").id
Note For Microsoft Excel, use worksheet menu bar instead of menu bar in the previous example.
You use the same command to find the control ID for a toolbar button. For example, the following command displays the control ID for the Document Map button (Standard toolbar) in Word:
? commandbars ("standard").controls ("document map").id
Finding all the control IDs for a menu or toolbar
If you want to find the control IDs for all the items on a menu or toolbar, you can create a macro in VBA. For example, the following macro opens a series of message boxes to display the commands and corresponding control IDs for each item on the File menu for any Office 2003 application:
Sub EnumerateControls()
Dim icbc As Integer
Dim cbcs As CommandBarControls
Set cbcs = Application.CommandBars("Menu Bar").Controls("File").Controls
For icbc = 1 To cbcs.Count
MsgBox cbcs(icbc).Caption & " = " & cbcs(icbc).ID
Next icbc
End Sub
Note To disable all of the items on a menu, you can enter each item individually in the Group Policy snap-in. Or, you can disable the entire menu by entering the control ID for the menu itself.
Disabling shortcut keys
Jason