Freigeben über


WorkbookBase.PivotTableOpenConnection Event

Definition

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

public:
 event Microsoft::Office::Interop::Excel::WorkbookEvents_PivotTableOpenConnectionEventHandler ^ PivotTableOpenConnection;
public event Microsoft.Office.Interop.Excel.WorkbookEvents_PivotTableOpenConnectionEventHandler PivotTableOpenConnection;
member this.PivotTableOpenConnection : Microsoft.Office.Interop.Excel.WorkbookEvents_PivotTableOpenConnectionEventHandler 
Public Custom Event PivotTableOpenConnection As WorkbookEvents_PivotTableOpenConnectionEventHandler 

Event Type

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.

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.");
}
Sub ThisWorkbook_PivotTableOpenConnection( _
    ByVal Target As Excel.PivotTable) _
    Handles Me.PivotTableOpenConnection

    MsgBox("The PivotTable connection for " & _
        Target.Name & " was opened.")
End Sub

Applies to