LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 7 May 2008 17:38:29 -0400
Reply-To:     Jodene Fine <>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Jodene Fine <>
Subject:      pass a file name from script to syntax
Content-Type: text/plain; charset="us-ascii"

Dear all,

I am trying to make a script interface for users to select a file, and then pass the filename to syntax by calling the syntax from the script file. Is this possible? I think I might be missing a major concept here, since it isn't working. Thank you all in advance.


Here is the code I am using to test this idea:

- Note: the error is : 'A macro symbol is invalid in this context'

- Note deux: Test code indicates that a macro !infile when defined within the syntax is indeed OK




Sub Main

Dim StrGetfile As String

StrGetfile = GetFilePath(, "sav", ,"Please select the file to process", 0)

' Define macro for file name

CmdStr = "DEFINE !infile() '" & StrGetfile & "' !ENDDEFINE." & vbCr

' Run syntax file

Set objSyntaxDoc = objSpssApp.OpenSyntaxDoc ("testpassname.sps")




Set objSyntaxDoc = Nothing

End Sub


* This is a simplified syntax file 'testpassname.sps'.

* I expect !infile from the script to be passed (erroneously?).

* SPSS tells me that on the get file statement !infile is invalid.


get file = !infile.



Jodene Goldenring Fine, Ph.D.

MSU Center for Neurodevelopmental Study

Departments of Psychology and Psychiatry

321 West Fee Hall

East Lansing, MI 48854

(517) 353-5035 (517) 432-2662 fax

"Be a nice person and see if it works."

Chinese Fortune Cookie, Berkeley, CA, circa 1974


Legal Notice Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. The material in this transmission may contain confidential information intended for the addressee. If you are not the addressee, any disclosure or use of this information by you is strictly prohibited. If you have received this transmission in error, please delete it and destroy all copies

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

Back to: Top of message | Previous page | Main SPSSX-L page