Share via


WorkbookBase.PivotTableCloseConnection Event

Definition

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

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

Event Type

Examples

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

This example is for a document-level customization.

private void WorkbookPivotTableCloseConnection()
{
    this.PivotTableCloseConnection +=
        new Excel.WorkbookEvents_PivotTableCloseConnectionEventHandler(
        ThisWorkbook_PivotTableCloseConnection);
}

void ThisWorkbook_PivotTableCloseConnection(
    Excel.PivotTable Target)
{
    MessageBox.Show("The PivotTable connection for " + Target.Name +
        " was closed.");
}
Sub ThisWorkbook_PivotTableCloseConnection( _
    ByVal Target As Excel.PivotTable) _
    Handles Me.PivotTableCloseConnection

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

Applies to