Partager via


WorkbookBase.PivotTableCloseConnection Event

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

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

Syntax

'Declaration
Public Event PivotTableCloseConnection As WorkbookEvents_PivotTableCloseConnectionEventHandler
public event WorkbookEvents_PivotTableCloseConnectionEventHandler PivotTableCloseConnection

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.

Sub ThisWorkbook_PivotTableCloseConnection( _
    ByVal Target As Excel.PivotTable) _
    Handles Me.PivotTableCloseConnection

    MsgBox("The PivotTable connection for " & _
        Target.Name & " was closed.")
End Sub
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.");
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace