Bagikan melalui


Workbook.SheetCalculate Event (2007 System)

Occurs after any worksheet is recalculated or after any changed data is plotted on a chart.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event SheetCalculate As WorkbookEvents_SheetCalculateEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_SheetCalculateEventHandler 

AddHandler instance.SheetCalculate, handler
public event WorkbookEvents_SheetCalculateEventHandler SheetCalculate
public:
 event WorkbookEvents_SheetCalculateEventHandler^ SheetCalculate {
    void add (WorkbookEvents_SheetCalculateEventHandler^ value);
    void remove (WorkbookEvents_SheetCalculateEventHandler^ value);
}
JScript does not support events.

Examples

The following code example demonstrates a handler for the SheetCalculate event. The event handler displays the name of the worksheet that is being calculated.

This example is for a document-level customization.

Sub ThisWorkbook_SheetCalculate(ByVal Sh As Object) _
    Handles Me.SheetCalculate
    MsgBox(CType(Sh, Excel.Worksheet).Name & " is being calculated")
End Sub
private void WorkbookSheetCalculate()
{
    this.SheetCalculate +=
        new Excel.WorkbookEvents_SheetCalculateEventHandler(
        ThisWorkbook_SheetCalculate);
}

void ThisWorkbook_SheetCalculate(object Sh)
{
    MessageBox.Show(((Excel.Worksheet)Sh).Name +
        " is being calculated");
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace