Class WorkbookConnection (Excel VBA)
A connection is a set of information needed to obtain data from an external data source other than a Microsoft Excel workbook.
To use a WorkbookConnection class variable it first needs to be instantiated, for example
Dim wbcon as WorkbookConnection Set wbcon = ActiveWorkbook.Connections(Index:=1)
The following procedures can be used to set variables of type WorkbookConnection: Connections.Add2, Connections.AddFromFile, Connections.Item, Model.AddConnection, Model.CreateModelWorkbookConnection, Model.DataModelConnection, ModelTable.SourceWorkbookConnection, PivotCache.WorkbookConnection, QueryTable.WorkbookConnection, SlicerCache.WorkbookConnection, TableObject.WorkbookConnection and XmlMap.WorkbookConnection.
Here is an example of processing the WorkbookConnection items in a collection.
Dim wbconConnection As WorkbookConnection For Each wbconConnection In ActiveWorkbook.Connections Next wbconConnection
Delete - Deletes a workbook connection.
Refresh - Refreshes a workbook connection.
Name (Default member) - Returns or sets the name of the WorkbookConnection object.
Description returns or sets a brief description for a WorkbookConnection object.
InModel specifies whether the WorkbookConnection has been added to the model.
ModelConnection returns an object that contains information for the new model connection type introduced in Excel 2013 to interact with the integrated Data Model.
ODBCConnection returns the ODBC connection details for the specified WorkbookConnection object.
OLEDBConnection returns the OLEDB connection details for the specified WorkbookConnection object.
Ranges returns the range of objects for the specified WorkbookConnection object.
RefreshWithRefreshAll determines if the connection should be refreshed when Refresh All is executed.
Type returns the workbook connection type.
DataFeedConnection - Contains the data and functionality needed to connect to data feeds. The same object is used for all Data Feed types.
ModelConnection - Contains information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated data model.
ModelTables - A collection of model tables inside the data model.
ODBCConnection - Represents the ODBC connection.
OLEDBConnection - Represents the OLE DB connection.
Ranges - A collection of Range objects.
TextConnection - Contains Service Contract settings that enable Microsoft Excel to connect to a Data Feed data source.
WorksheetDataConnection - Used to import data into the data model from data on the worksheet such as ranges and tables.