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
' Requirements	: data file must be in the data editor
' Results		: for each variable name; the var name and the var label are saved in a text file.
' Instuctions	: Run this script first then import the txt file into MS Access
' Raynald Levesque 2000/09/21 rlevesque@videotron.ca


Option Explicit
Sub Main
Dim objSPSSInfo As ISpssInfo
Dim NumVars As Long,I As Long,J As Long, VarName As String, VarLabel As String
 
Set objSPSSInfo = objSpssApp.SpssInfo
NumVars=objSPSSInfo.NumVariables-1
Open "c:\\temp\\variable label.txt" For Output As #1

For I=0 To NumVars
	  VarName= objSPSSInfo.VariableAt(I)
      VarLabel= objSPSSInfo.VariableLabelAt(I)
		If Len(varlabel)=0 Then 
           	varlabel=varname
        End If
        Print #1, Varname & "," & VarLabel 
Next I
Close #1
End Sub