View
214
Download
0
Embed Size (px)
Citation preview
Customizing Menus and Toolbars
Manipulating Command Bars
• Customize:– Right-click any place on a command bar and
cick Customize …• Customize window:
– Toolbars, Commands, Options
• Moving and resizing command bars
• Showing and hiding command bars
Showing and hiding toolbar buttons
• Click (not right-click) the Toolbar Option button
• Click Add or remove buttons
How to remove “Type a question for help” box
• With the Customize window open, – Right-click the box– Clear the checkbox next to the Show the Ask
…
Changing the Properties of Built-In Buttons
• Open the Customizing window• Select the toolbar from the Toolbar list• Right-click the button in the toolbar and choose
the property to change:– Name– Change button image– Properties window:
• ScreenTip• OnAction
– Macro– VBA function: =MsgBox(“Hello”)
Restoring Toolbar Default
• With Customizing window open:– Click Toolbars tab– Select the toolbar– Click Properties button– Click Restore Defaults button
Creating New Toolbar
• With Customizing window open:– Click Toolbars tab– Click the New button– Enter a name– Adding buttons to the new toolbar
• Click Commands tab• Select Categories• Select commands• Drag the command to the new toolbar
Creating New Button• With the Customizing window open:
– Click Commands tab– Click File in the Categories box– Click the Custom button– Drag the Custom button to the toolbar– Right-click the new Custom button in the toolbar to
change properties:• Name• Default style• Text only• Assign hyperlink• Properties
– Screen tip– OnAction
Creating Menu and Submenu
• With the Customizing window open:– Click Commands tab– Click New Menu in the Categories box– Drag the New Menu to the toolbar– Right-click the new menu to assign a new
name for the menu– Select and drag buttons to the new menu
• Submenu– Same procedure
Attaching a Customer Command Bar to an Object
• Forms, reports and Commands have properties to attach a custom toolbar or menu bar.
The CommandBars Collection
• Application– CommandBars
• This collection contains:– Menu bars– Toolbars– Shortcut menus– Custom command bars
Access Built-in command bars
• 1 menu bar named “Menu Bar”
• 51 tool bars
• 126 shortcut menus
To Retrieve a Commandbar from the Collection
• CommandBars(“commandbar name”)• Commandbar properties:
– Object browser
• Example:– Private Sub Command0_Click()– CommandBars("menu bar").Enabled = True– End Sub– Private Sub Command1_Click()– CommandBars("menu bar").Enabled = False– End Sub