PivotTable.ChangeConnection method (Excel)

Changes the connection of the specified PivotTable object.

Syntax

expression.ChangeConnection (conn)

expression A variable that represents a PivotTable object.

Parameters

Name Required/Optional Data type Description
conn Required WorkbookConnection A WorkbookConnection object that represents the new connection for the PivotTable.

Remarks

The ChangeConnection method can only be used with a PivotTable that is connected to an external data source. A run-time error occurs if the ChangeConnection method is used with a PivotTable that uses data stored on a worksheet as its data source.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.