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
'BEGIN DESCRIPTION
' RUN designated syntax file in BATCH mode.
' This is useful when we want processing to stop on the first error.
' Raynald Levesque 2004/03/02
'END DESCRIPTION

Sub Main

' Assign this script to a custom button in your Syntax window toolbar

        Dim objSyntaxDoc As ISpssSyntaxDoc
        Dim strDocPath As String

        Set objSyntaxDoc = objSpssApp.GetDesignatedSyntaxDoc
        strDocPath = objSyntaxDoc.GetDocumentPath
        Debug.Print strDocPath
        objSyntaxDoc.Visible =True

        If MsgBox ("Save then run this syntax up to first error?", vbYesNo) = vbYes Then
                objSyntaxDoc.SaveAs strDocPath
                objSpssApp.ExecuteInclude (strDocPath,False)
        End If
        Set objSyntaxDoc = Nothing

End Sub