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.
The classes Model, ModelTable, PivotCache, QueryTable, SlicerCache, TableObject and XmlMap. give access to class WorkbookConnection
Dim wbcon as WorkbookConnection
Set wbcon = ActiveWorkbook.Connections(Index:=1)
For Each
Here is an example of processing the WorkbookConnection items in a collection.
Dim wbconConnection As WorkbookConnection
For Each wbconConnection In ActiveWorkbook.Connections
Next wbconConnection
Methods
Delete - Deletes a workbook connection.
Refresh - Refreshes a workbook connection.
Properties
Name (Default member) - Returns or sets the name of the WorkbookConnection object.
DataFeedConnection returns a DataFeedConnection object that contains the data and functionality needed to connect to data feeds.
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.
ModelTables returns a ModelTables object associated with the particular connection.
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.
TextConnection returns a TextConnection object that contains the information on a query to a text file.
Type returns the workbook connection type.
WorksheetDataConnection returns an object that contains information for a connection from the PowerPivot Model to data within the workbook, such as a range, named range, or table.
Related Classes
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.