Bagikan melalui


Workbook.PivotTableOpenConnection Event (2007 System)

Occurs after a PivotTable report opens the connection to its data source.

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

Syntax

'Declaration
Public Event PivotTableOpenConnection As WorkbookEvents_PivotTableOpenConnectionEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_PivotTableOpenConnectionEventHandler 

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

Examples

The following code example demonstrates a handler for the PivotTableOpenConnection event. The event handler displays a message when a PivotTable report opens the connection to its data source.

This example is for a document-level customization.

Sub ThisWorkbook_PivotTableOpenConnection( _
    ByVal Target As Excel.PivotTable) _
    Handles Me.PivotTableOpenConnection

    MsgBox("The PivotTable connection for " & _
        Target.Name & " was opened.")
End Sub
private void WorkbookPivotTableOpenConnection()
{
    this.PivotTableOpenConnection +=
        new Excel.WorkbookEvents_PivotTableOpenConnectionEventHandler(
        ThisWorkbook_PivotTableOpenConnection);
}

void ThisWorkbook_PivotTableOpenConnection(
    Excel.PivotTable Target)
{
    MessageBox.Show("The PivotTable connection for " + Target.Name +
        " was opened.");
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace