Compartilhar via


Evento WorkbookBase.PivotTableOpenConnection

Ocorre depois que um relatório de tabela dinâmica abre a conexão a sua fonte de dados.

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

Sintaxe

'Declaração
Public Event PivotTableOpenConnection As WorkbookEvents_PivotTableOpenConnectionEventHandler
public event WorkbookEvents_PivotTableOpenConnectionEventHandler PivotTableOpenConnection

Exemplos

O exemplo de código a seguir demonstra um manipulador para o evento de PivotTableOpenConnection . O manipulador de eventos exibe uma mensagem quando um relatório de tabela dinâmica abre a conexão a sua fonte de dados.

Este exemplo destina-se a uma personalização no nível de documento.

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.");
}

Segurança do .NET Framework

Consulte também

Referência

WorkbookBase Classe

Namespace Microsoft.Office.Tools.Excel