OnAction Property

Applies To

Arc Object, Arcs Collection, Button Object, Buttons Collection, ChartObject Object, ChartObjects Collection, CheckBox Object, DialogFrame Object, Drawing Object, DrawingObjects Collection, Drawings Collection, DropDown Object, DropDowns Collection, EditBox Object, EditBoxes Collection, GroupBox Object, GroupBoxes Collection, GroupObject Object, GroupObjects Collection, Label Object, Labels Collection, Line Object, Lines Collection, ListBox Object, ListBoxes Collection, MenuItem Object, OLEObject Object, OLEObjects Collection, OptionButton Object, OptionButtons Collection, Oval Object, Ovals Collection, Picture Object, Pictures Collection, Rectangle Object, Rectangles Collection, ScrollBar Object, ScrollBars Collection, Spinner Object, Spinners Collection, TextBox Object, TextBoxes Collection, ToolbarButton Object.

Description

Returns or sets the name of a macro that runs when the object is clicked. Read-write.

Remarks

Setting this property for a menu item overrides any custom help information set up for the menu item with the information set up for the assigned macro.

This property cannot be used with a toolbar button that is a gap or that has a palette or list attached (such as the Font or Style buttons).

See Also

Add Method, Help Method, MacroOptions Method, StatusBar Property.

Example

This example replaces the built-in function of the Print button (button five on the Standard toolbar) with the my_Print_Macro procedure.


ToolBars("Standard").ToolbarButtons(5).OnAction = "my_Print_Macro"

This example restores the built-in function of the Print button (button five on the Standard toolbar).


ToolBars("Standard").ToolbarButtons(5).OnAction = ""