Upravit

Sdílet prostřednictvím


Model.AddConnection method (Excel)

Adds a new WorkbookConnection to the model with the same properties as the one supplied as an argument.

Syntax

expression.AddConnection (ConnectionToDataSource)

expression A variable that represents a Model object.

Parameters

Name Required/Optional Data type Description
ConnectionToDataSource Required WORKBOOKCONNECTION The Workbook connection.

Return value

WORKBOOKCONNECTION

Remarks

This method only works on legacy/non-model external connections and will fail with a run-time error if called with an external model connection as its argument. When calling this method, a new model connection is created and it is named the same as the legacy connection with the existing logic for making the name unique applied (integer at the end).

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.