1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Sub Main
' gets a file path (see User Input in Sax Basic Language for options)
' Defines a macro !pathd which contains the path (without the file name)
' of the selected file
' If syntax is written using !pathd instead of hard coded path for instance
' GET FILE=!pathd + 'mydata.sav'.
' This script allows user to browse to the desired folder and the macro is
' defined by the script.
' Ray
	Dim strCmd As String
	Dim strPath As String
	Dim strFPath As String
	strFPath =GetFilePath(, , ,"Select any file from the required folder", 0)
	If strFPath = "" Then Exit Sub 'User clicked Cancel
	strPath = Mid(strFPath,1,InStrRev(strFPath,"\\"))
	strCmd="DEFINE !pathd()'" & strPath & "'!ENDDEFINE"
	Debug.Print strCmd
	objSpssApp.ExecuteCommands strCmd, False

End Sub