Specifications

Chapter 8 189
Save and Recall Files
Example Programs for Saving/Recalling a File
8. Save and Recall Files
760 Dim msg As String, file As String, err_mes As String
770 Dim err_no As Integer
780
790 input_name:
800 msg = "Input the state file name without extension you wish
to save."
810 file = InputBox(msg, "file name")
820 If file = "" Then GoTo input_end
830 file = """" & file & """"
840 msg = "file name : " & file & vbCrLf & vbCrLf & "Do you
want to change the file name again?"
850 ans = MsgBox(msg, vbYesNo)
860 If ans = vbNo Then
870 SCPI.Output "*CLS"
880 SCPI.Output "MMEM:STOR " & file
890 SCPI.Output "SYST:ERR?"
900 SCPI.Enter err_no, "#"
910 SCPI.Enter err_mes
920 If err_no <> 0 Then
930 MsgBox (err_mes & "occured")
940 GoTo input_name
950 ElseIf err_no = 0 Then
960 MsgBox ("save done")
970 End If
980 ElseIf ans = vbYes Then
990 GoTo input_name
1000 End If
1010 input_end:
1020 End Sub
1030
1040 Private Sub recall_state()
1050 Dim msg As String, file As String, err_mes As String
1060 Dim err_no As Integer
1070
1080 input_name:
1090 msg = "Input the state file name without extension you
wish to recall."
1100 file = InputBox(msg, "file name")
1110 If file = "" Then GoTo input_end
1120 file = """" & file & """"
1130 msg = "file name : " & file & vbCrLf & vbCrLf & "Do you
want to change the file name again?"
1140 msg = "Do you want to change file name again?"
1150 ans = MsgBox(msg, vbYesNo)
1160 If ans = vbNo Then
1170 SCPI.Output "*CLS"
1180 SCPI.Output "MMEM:LOAD " & file
1190 SCPI.Output "SYST:ERR?"
1200 SCPI.Enter err_no, "#"
1210 SCPI.Enter err_mes
1220 If err_no <> 0 Then
1230 MsgBox (err_mes & "occured")
1240 GoTo input_name
1250 ElseIf err_no = 0 Then
1260 MsgBox ("recall done")
1270 End If
1280 ElseIf ans = vbYes Then
1290 GoTo input_name