April 2006
Beginner
1114 pages
98h 16m
English
querytable.Connection [= setting]
Sets or returns the data source for the query table. For web queries, this is the Connection argument used to create the query. Getting or setting this property causes an error if the query table is created from a recordset (QueryType property is xlADORecordset or xlDAORecordset).
The following code displays the Connection property for each query table on the active worksheet:
Dim qt As QueryTable
For Each qt In ActiveSheet.QueryTables
Select Case qt.QueryType
Case xlADORecordset, xlDAORecordset
Debug.Print qt.Name, qt.Recordset.Source
Case Else ' Includes Web queries.
Debug.Print qt.Name, qt.Connection
End Select
NextRead now
Unlock full access