|
|
|
|
|
|
Word
|
Create Toggle Button for a Command Bar
|
|
Ease of Use
|
Easy
|
Version tested with
|
2002
|
Submitted by:
|
Jacob Hilderbrand
|
Description:
|
Demonstrates how to create a toggle button to turn on or off a Word toolbar. This examples turns on the Function Keys toolbar.
|
Discussion:
|
Do you find yourself often turning on a specific toolbar? This macro demonstrates how to use VBA to create a toggle button for a toolbar, much like the Drawing Toolbar toggle button found on Word's Standard toolbar. Our sample displays the Function Keys (F1 - F12) Toolbar.
The Function Keys provide some useful shortcuts. There is a built-in Command Bar that you can toggle on and off with this macro.
|
Code:
|
instructions for use
|
Option Explicit
Sub ShowFunctionKeysCommandBar()
CommandBars("Function Key Display").Visible = Not _
(CommandBars("Function Key Display").Visible)
End Sub
|
How to use:
|
- Open Word.
- Press Alt + F11 to open Visual Basic Editor (VBE).
- In the Project Explorer select Normal (to have the macro available to all Word files).
- From the Menu, choose Insert-Module.
- Paste the code into the window at right.
- Hit the Save diskette.
- Press Alt + Q or press the X in the top right corner to close VBE.
|
Test the code:
|
- Tools | Macro | Macros
- Select "ShowFunctionKeysCommandBar" and press Run
|
Sample File:
|
FunctionKeysCommandBar.ZIP 5.65KB
|
Approved by mdmackillop
|
This entry has been viewed 114 times.
|
|