BeforeCommand Event

See Also                  Applies To

Occurs when a worksheet command is used, before the default command action. This event allows you to programmatically cancel or change the command.

Syntax

Private Sub Spreadsheet_BeforeCommand(SpreadsheetEventInfo As SpreadsheetEventInfo)

SpreadsheetEventInfo   The SpreadsheetEventInfo object that contains information about the event.

Remarks

Set the SpreadsheetEventInfo object’s ReturnValue property to False to prevent the specified change from occurring.

Use the Command property to determine the command that caused the event to occur. The Command property returns one of the SheetCommandEnum constants. Note that the ssHelp command constant is not supported.

Remarks

For information about using events with VBScript, see Declaring and Using Event Procedures in VBScript.