User Guide

650
Chapter 46
TextBox 40,28,340,21,.txtFilename
OKButton 470,7,100,21,.cmdOK
CancelButto
n 470,35,100,21,.cmdCancel
End Dialog
Dim dlg As UserDialog
Dialog dlg
End Sub
'define funct
ion that determines behavior of dialog box
Function DialogFunc(strDlgItem As String, intAction As Integer, intSuppValue As Integer) As Boolean
Select Case intAction
Case 1' beep whe
n dialog is initialized
Beep
Case 2' value changing or button pressed
Select Case str
DlgItem
Case "cmdOK"'if user clicks OK, open data file with specified filename
strFilename = DlgText("txtFilename")
Call OpenDataFi
le(strFilename)
DialogFunc = False
Case "cmdCancel"'If user clicks Cancel, close dialog
DialogFunc = Fal
se
End Select
End Select
End Function
Sub OpenDataFile(strFilename As Variant)'Open data file with s pecified filenam e
Dim objDataDoc As
ISpssDataDoc
Set objDataDoc = objSpssApp.OpenDataDoc(strFilename)
End Sub
Examples are also
available in the online Help. You can try them yourself by pasting
the code from Help into the script window.
Debugging Script
s
The Debug menu all
ows you to step through your code, executing one line or
subroutine at a time and viewing the result. You can also insert a break point in the
script to pause the execution at the line that contains the break point.