Model.AddConnection (Excel)

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

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).

AddConnection (ConnectionToDataSource)

ConnectionToDataSource: The Workbook connection.


Dim wbconAddConnection As WorkbookConnection
Set wbconAddConnection = ActiveWorkbook.Model.AddConnection(ConnectionToDataSource:=)