共用方式為


PivotTable.CreateCubeFile Method (Excel)

Creates a cube file from a PivotTable report connected to an Online Analytical Processing (OLAP) data source.

Syntax

expression .CreateCubeFile(File, Measures, Levels, Members, Properties)

expression A variable that represents a PivotTable object.

Parameters

Name

Required/Optional

Data Type

Description

File

Required

String

The name of the cube file to be created. It will overwrite the file if it already exists.

Measures

Optional

Variant

An array of unique names of measures that are to be part of the slice.

Levels

Optional

Variant

An array of strings. Each array item is a unique level name. It represents the lowest level of a hierarchy that is in the slice.

Members

Optional

Variant

An array of string arrays. The elements correspond, in order, to the hierarchies represented in the Levels array. Each element is an array of string arrays that consists of the unique names of the top level members in the dimension that are to be included in the slice.

Properties

Optional

Variant

False results in no member properties being included in the slice. The default value is True.

Return Value

String

Example

This example creates a cube file titled "CustomCubeFile" on drive C:\ with no member properties to be included in the slice. With the Measures, Levels, and Members arguments omitted from this example, the cube file will end up matching the view of the PivotTable report. This example assumes a PivotTable report connected to an OLAP data source exists on the active worksheet.

Sub UseCreateCubeFile() 
 
 ActiveSheet.PivotTables(1).CreateCubeFile _ 
 File:="C:\CustomCubeFile", Properties:=False 
 
End Sub

請參閱

概念

PivotTable Object

PivotTable Object Members