PivotCache.QueryType procedure builder

PivotCache.QueryType (Excel)

Indicates the type of query used by Microsoft Excel to populate the PivotTable cache.

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.

Dim xqtQueryType As XlQueryType
xqtQueryType = ActiveWorkbook.PivotCaches(1).QueryType