This documentation is archived and is not being maintained.

Workbook.PivotTableWizard Method

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

void PivotTableWizard(
	Object SourceType,
	Object SourceData,
	Object TableDestination,
	Object TableName,
	Object RowGrand,
	Object ColumnGrand,
	Object SaveData,
	Object HasAutoFormat,
	Object AutoPage,
	Object Reserved,
	Object BackgroundQuery,
	Object OptimizeCache,
	Object PageFieldOrder,
	Object PageFieldWrapCount,
	Object ReadData,
	Object Connection


Type: System.Object
An XlPivotTableSourceType value. The source of the report data.
Type: System.Object
The data for the new report. Can be a Range object, an array of ranges, or a text constant that represents the name of another report. For an external database, SourceData is an array of strings containing the SQL query string, where each element is up to 255 characters in length. You should use the Connection argument to specify the ODBC connection string. For compatibility with earlier versions of Excel, SourceData can be a two-element array. The first element is the connection string specifying the ODBC source for the data. The second element is the SQL query string used to get the data. If you specify SourceData, you must also specify SourceType. If the active cell is inside the SourceData range, you must specify TableDestination as well.
Type: System.Object
A Range object specifying where the report should be placed on the worksheet. If this argument is omitted, the report is placed at the active cell.
Type: System.Object
The name of the new report.
Type: System.Object
true to show grand totals for rows in the report.
Type: System.Object
true to show grand totals for columns in the report.
Type: System.Object
true to save data with the report; false to save only the report definition.
Type: System.Object
true to have Microsoft Office Excel automatically format the report when it is refreshed or when fields are moved.
Type: System.Object
Valid only if SourceType is xlConsolidation. true to have Excel create a page field for the consolidation. If AutoPage is false, you must create the page field or fields.
Type: System.Object
Not used by Excel.
Type: System.Object
true to have Excel perform queries for the report asynchronously (in the background). The default value is false.
Type: System.Object
true to optimize the PivotTable cache when it is constructed. The default value is false.
Type: System.Object
The order in which page fields are added to the PivotTable report’s layout. Can be one of the following XlOrder constants: xlDownThenOver or xlOverThenDown. The default value is xlDownThenOver.
Type: System.Object
The number of page fields in each column or row in the PivotTable report. The default value is 0 (zero).
Type: System.Object
true to create a PivotTable cache that contains all records from the external database; this cache can be very large. If ReadData is false, you can set some of the fields as server-based page fields before the data is actually read.
Type: System.Object
A string that contains ODBC settings that allow Excel to connect to an ODBC data source. The connection string has the form "ODBC;<connection string>". This argument overrides any previous setting for the PivotCache object’s Connection property.

This method does not display the PivotTable Wizard. This method is not available for OLE DB data sources. Use the Add method to add a PivotTable cache, and then create a PivotTable report based on the cache.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.