file->new->script->粘贴以下语法(其中的"SetDecimalDigits objPivot, 5"是定义小数位数的) -> 选中要编辑的pivot table后->运行该语法即可
Sub Main
Dim objPivot As PivotTable
Dim objItem As ISpssItem
GetFirstSelectedPivot objPivot, objItem, True, True
objPivot.UpdateScreen = False
'set all cell formats to 5 decimal digits
SetDecimalDigits objPivot, 5
objPivot.UpdateScreen = True
objItem.Deactivate
objItem.ActivateTable
objItem.Deactivate
End Sub
Sub SetDecimalDigits(objPivot As PivotTable, intDigits As Integer)
Dim lngRow As Long, lngCol As Long
Dim objDataCells As ISpssDataCells
Set objDataCells = objPivot.DataCellArray
With objDataCells
For lngRow = 0 To .NumRows - 1
For lngCol = 0 To .NumColumns - 1
If Not IsNull (.ValueAt (lngRow, lngCol)) Then
.HDecDigitsAt (lngRow, lngCol) = intDigits
End If
Next
Next
End With
objPivot.Autofit
End Sub
[此贴子已经被作者于2007-10-19 11:40:26编辑过]