PivotTable.PivotTableWizard Method

Definition

Creates a PivotTable object. This method doesn’t display the PivotTable Wizard. This method isn’t available for OLE DB data sources. Use the Add(PivotCache, Object, Object, Object, Object) method to add a PivotTable cache, and then create a PivotTable report based on the cache.

public 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);
Public Sub PivotTableWizard (Optional SourceType As Object, Optional SourceData As Object, Optional TableDestination As Object, Optional TableName As Object, Optional RowGrand As Object, Optional ColumnGrand As Object, Optional SaveData As Object, Optional HasAutoFormat As Object, Optional AutoPage As Object, Optional Reserved As Object, Optional BackgroundQuery As Object, Optional OptimizeCache As Object, Optional PageFieldOrder As Object, Optional PageFieldWrapCount As Object, Optional ReadData As Object, Optional Connection As Object)

Parameters

SourceType
Object

Optional XlPivotTableSourceType. The source of the report data.

SourceData
Object

Optional 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.

TableDestination
Object

Optional 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.

TableName
Object

Optional Object. A string that specifies the name of the new report.

RowGrand
Object

Optional Object. True to show grand totals for rows in the report.

ColumnGrand
Object

Optional Object. True to show grand totals for columns in the report.

SaveData
Object

Optional Object. True to save data with the report. False to save only the report definition.

HasAutoFormat
Object

Optional Object. True to have Microsoft Excel automatically format the report when it’s refreshed or when fields are moved.

AutoPage
Object

Optional Object. Valid only if SourceType is xlConsolidation. True to have Microsoft Excel create a page field for the consolidation. If AutoPage is False, you must create the page field or fields.

Reserved
Object

Optional Object. Not used by Microsoft Excel.

BackgroundQuery
Object

Optional Object. True to have Excel perform queries for the report asynchronously (in the background). The default value is False.

OptimizeCache
Object

Optional Object. True to optimize the PivotTable cache when it's constructed. The default value is False.

PageFieldOrder
Object

Optional 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.

PageFieldWrapCount
Object

Optional Object. The number of page fields in each column or row in the PivotTable report. The default value is 0 (zero).

ReadData
Object

Optional 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.

Connection
Object

Optional 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.

Applies to