QueryTable.QueryType (Excel)

Indicates the type of query used by Microsoft Excel to populate the query table. Possible return values are xlADORecordset - Based on an ADO recordset query, xlDAORecordset - Based on a DAO recordset query, for query tables only, xlODBCQuery - Based on an ODBC data source, xlOLEDBQuery - Based on an OLE DB query, including OLAP data sources, xlTextImport - Based on a text file, for query tables only, xlWebQuery - Based on a webpage, for query tables only.

You specify the data source in the prefix for the Connection property's value. If you import data by using the user interface, data from a web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object. If you import data by using the object model, data from a web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable. You can use the QueryTable property of the ListObject to access the QueryType property.


Dim xqtQueryType As XlQueryType
xqtQueryType = ActiveCell.QueryTable.QueryType