全部显示

SmallGrid 属性

       

如果 Microsoft Excel 为新建的数据透视表使用一个具有两个单元格宽度和两个单元格高度的网格,则该值为 True。如果 Excel 使用一个空白模板边框,则该值为 FalseBoolean 类型,可读写。

说明

应使用模板边框。使用网格的目的仅是为了与早期版本的 Excel 兼容。

示例

本示例在活动工作表的 A3 单元格上新建一个基于 OLAP 提供程序的数据透视表高速缓存,然后基于该高速缓存新建一个数据透视表。本示例使用模板边框而不使用单元格网格。

With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
    .Connection = _
        "OLEDB;Provider=MSOLAP;Location=srvdata;Initial Catalog=National"
    .MaintainConnection = True
    .CreatePivotTable TableDestination:=Range("A3"), _
        TableName:= "PivotTable1"
End With
With ActiveSheet.PivotTables("PivotTable1")
    .SmallGrid = False
    .PivotCache.RefreshPeriod = 0
    With .CubeFields("[state]")
        .Orientation = xlColumnField
        .Position = 0
    End With
    With .CubeFields("[Measures].[Count Of au_id]")
        .Orientation = xlDataField
        .Position = 0
    End With
End With