This is corrected version of Size labels to avoid line-wrapping script to work in SPSS versions 16+. Note USES comment in the top, it's important. I have also disabled resizing column labels available in older version, as I failed to make it working properly anyway. So, this script can resize only row labels. If you use SPSS version prior to 16, use original version of the script.

UPD: If scriptContext condition was added to enable this script working as Autoscript when necessary.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'Begin Description
'This script adjusts the width of row labels and column labels so that the labels fit on one line -- they don't wrap.
'Requirements: The pivot table on which the script will be run should be selected.
'End Description

'IMPORTANT!
'--->>> If you use SPSS v. 16 or later (you, probably, do now :),
'--->>> check out where Global.wwd file lives in YOUR SYSTEM and adjust the path in next line accordingly.
'#Uses "C:\Program Files\PS IMAGO PRO\4\Predictive Solutions\PS IMAGO PRO\4\IBM\SPSS\Statistics\24\Samples\Global.wwd"
'--->>> This is necessary amendment to make this older script run in newer SPSS versions.

Option Explicit

Sub Main

	'Declare SPSS object variables
	Dim objPivotTableMain As PivotTable
	Dim objItemMain As ISpssItem

	Dim bolFoundOutputDoc As Boolean
	Dim bolPivotSelected As Boolean

	' This If...Else...End If clause enables script to be run either in manual mode or as autoscript. Simply associate script file with
	' the output you want to process automatically in Edit...Options...Scripts menu.
	If scriptContext Is Nothing Then
		'Script was run manually, so,
		'call GetFirstSelectedPivot to get the selected pivot table
		'(GetFirstSelectedPivot is a global procedure in Global.wwd (the default Global Procedure file, we linked it with #Uses statement above))
		Call GetFirstSelectedPivot(objPivotTableMain, objItemMain, bolFoundOutputDoc, bolPivotSelected)
	Else
		Set objItemMain = scriptContext.GetOutputItem()
		Set objPivotTableMain = objItemMain.ActivateTable
		bolFoundOutputDoc = True
		bolPivotSelected = True
	End If


	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

	objPivotTableMain.ClearSelection

	'Call SetPivotTableColumnLabelsToNoWrap (objPivotTableMain) ' Disabled as resizing column labels
                                                                    ' seems not working properly in 16+
	Call SetPivotTableRowLabelsToNoWrap (objPivotTableMain)


	' Deactivate the pivot table and exit
	objItemMain.Deactivate

End Sub