'Begin Description 'This script deletes all row and column labels in the selected Pivot Table. 'Requirement: The Pivot Table you want to change must be selected. 'End Description 'PURPOSE 'This script deletes all row and column labels in the selected Pivot Table 'ASSUMPTIONS 'A is selected in the Navigator (Output Document). 'Also, the Navigator (Output Document) that contains the Pivot Table is the Designated Output Window 'EFFECTS 'Row and Column labels will be changed to null strings 'HINTS 'If you are new to programming, select Scripting Tips from the 'Help menu for a basic introduction. 'For information on SPSS automation objects, properties and methods, 'press F2 to display the Object Browser. 'For context-sensitive help on Sax Basic terms as well as SPSS objects, 'properties, and methods, press F1. Option Explicit 'All variables must be declarated before being used '*********************************************************************** Sub Main 'Declare variables here Dim objPivotTable As PivotTable Dim objItem As ISpssItem Dim bolFoundOutputDoc As Boolean Dim bolPivotSelected As Boolean 'The following procedure is a global procedure that is located in global.sbs Call GetFirstSelectedPivot(objPivotTable, objItem, bolFoundOutputDoc, bolPivotSelected) If (bolFoundOutputDoc = False) Or (bolPivotSelected = False) Then 'either there wasn't an output doc or a pivot table wasn't selected Exit Sub End If 'This is the REAL call blank out the rows and columns Call BlankLabels(objPivotTable) objItem.Deactivate End Sub '********************************************************************** Sub BlankLabels(objPivotTable As PivotTable) 'Purpose: Deletes all row and column labels in a Pivot Table 'Assumptions: The Pivot Table is already activated 'Effects: Row and column labels will be empty (null) 'Inputs: objPivotTable -- the selected Pivot Table 'Return Values: Pivot Table with Row and Column labels deleted 'Declare SPSS-specific objects Dim objColLabels As ISpssLabels Dim objRowLabels As ISpssLabels Dim objDataCells As ISpssDataCells 'Declare various integer indices Dim lngRowNum As Long Dim lngColNum As Long Dim lngNumCols As Long Dim lngNumRows As Long 'Instantiate SPSS objects Set objDataCells = objPivotTable.DataCellArray() Set objColLabels = objPivotTable.ColumnLabelArray() Set objRowLabels = objPivotTable.RowLabelArray() lngNumCols = objColLabels.NumColumns lngNumRows = objColLabels.NumRows 'Extracting column labels 'The label at (1,N) does not exist, so do not access it For lngRowNum = 0 To lngNumRows - 1 For lngColNum = 0 To lngNumCols - 1 If Not IsNull(objColLabels.ValueAt(lngRowNum,lngColNum)) Then objColLabels.ValueAt(lngRowNum,lngColNum) = "" End If Next lngColNum Next lngRowNum lngNumCols = objRowLabels.NumColumns lngNumRows = objRowLabels.NumRows 'Extracting row labels 'The label at (N,1) does not exist, so do not access it For lngRowNum = 0 To lngNumRows - 1 For lngColNum = 0 To lngNumCols - 1 If Not IsNull(objRowLabels.ValueAt(lngRowNum,lngColNum)) Then objRowLabels.ValueAt(lngRowNum,lngColNum) = "" End If Next lngColNum Next lngRowNum End Sub '*******************************************************************