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
' Add word Index at the beginning of variable labels
' Posted to spss newsgroup by Raynald Levesque on 2003/10/10

Option Explicit
Const cPREFIX="Index "	'Replace the word as required

Sub Main()

	' Declare variables and get the variable list:
	Dim objSpssInfo As ISpssInfo
	Dim var As String
	Set objSpssInfo = objSpssApp.SpssInfo

	Dim lngNumber As Long
	Dim i As Long
	Dim strCmd As String
	lngNumber = objSpssInfo.NumVariables
	strCmd = "VARIABLE LABELS "
	Debug.Clear

	With objSpssInfo
		For i = 0 To lngNumber - 1
			strCmd = strCmd & " " & .VariableAt(i) & " '" & cPREFIX & .VariableLabelAt(i) & "'/" & vbCrLf
			Debug.Print strCmd
			Next
	End With
	strCmd = strCmd + "." & vbCrLf

	objSpssApp.ExecuteCommands strCmd, False
	Set objSpssInfo = Nothing
End Sub