Add a custom button that runs a Visual Basic function to a toolbar
- Create the function you want the button to run.
How?
- On the View menu, point to Toolbars, and then click Customize.
- If it isn't already displayed, show the toolbar you want to add the button to.
How?
- In the Customize dialog box, click the Commands tab.
- In the Categories box, click File.
- Drag the Custom command from the Commands box to the displayed toolbar.
- With the Customize dialog box open, right-click the button on the toolbar, and then on the shortcut menu, type a new name for the button in the Name box.
- On the same shortcut menu, click Properties.
- In the On Action box, type the name of the function you want to run in the format =functionname(). For example, for a custom function named SetCaption(), type =SetCaption(). For a built-in function, enter the name of the function and any required arguments, for example =MsgBox(IIf(Instr(Time(), "PM"), "Good Afternoon", "Good Morning")).
- Specify any other properties for the button.