CreateCubeFile Method

Microsoft Excel Visual Basic

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

expression    Required. An expression that returns one of the objects in the Applies To list.

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 Boolean. False results in no member properties being included in the slice. The default value is True.

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