Worksheet Events

Table 7.5 lists the events that are available for a worksheet in VSTO. Some of these events are available on the worksheet in VBA and exposed in the PIA, others were added from the Application object, and still others are specific to VSTO. Notice that some of the event names have been changed to avoid name collisions.

Table 7.5. Events of the Worksheet

Event

Description

ActivateEvent

Raised when the worksheet is activated.

BeforeDoubleClick

Raised when you double-click the worksheet. This event handler enables you to take action when the worksheet is double-clicked, before the default action takes place.

BeforeRightClick

Raised when you right-click the worksheet. This event handler enables you to take action when the worksheet is right-clicked, before the default action takes place.

Table 7.5. Events of the Worksheet (Continued)

Event

Description

BindingContextChanged

Raised when the binding context of the worksheet changes.

Calculate

Raised when you recalculate the worksheet.

Change

Raised when a change occurs within the worksheet.

Deactivate

Raised when the worksheet is deactivated.

Disposed

Raised when the worksheet is disposed of. This typically does not get raised until garbage collection is called to reclaim the memory that held the worksheet object.

FollowHyperlink

Raised when you click a hyperlink on the worksheet.

PivotTableUpdate

Raised when you update a pivot table on the worksheet.

SelectionChange

Raised when you move your selection within the worksheet.

Shutdown

Raised when the Worksheet class unloads. You typically add cleanup code to this event handler.

Startup

Raised when the Worksheet class is initialized. You typically add code here to set up the worksheet when it is created.

0 0

Post a comment