Specifications

190 Chapter 8
Save and Recall Files
Example Programs for Saving/Recalling a File
1300 End If
1310 input_end:
1320 End Sub
1330
1340 Private Sub save_data()
1350 Dim msg As String, file As String, file_type As String
1360 Dim err_mes As String, bool As String
1370 Dim i As Integer, err_no As Integer
1380
1390 For i = 1 To 4
1400 Select Case i
1410 Case 1
1420 ans = MsgBox("Do you want to save the data array?",
vbYesNo)
1430 Case 2
1440 ans = MsgBox("Do you want to save the data trace
array?", vbYesNo)
1450 Case 3
1460 ans = MsgBox("Do you want to save the memory array?",
vbYesNo)
1470 Case 4
1480 ans = MsgBox("Do you want to save the memory trace
array?", vbYesNo)
1490 End Select
1500 If asn = vbYes Then
1510 SCPI.Output "MMEM:STOR:TRAC:SEL" & CStr(i) & " ON"
1520 ElseIf ans = vbNo Then
1530 SCPI.Output "MMEM:STOR:TRAC:SEL" & CStr(i) & " OFF"
1540 End If
1550 Next i
1560
1570 msg = "Select the File type, ASCII or Binary." & vbCrLf &
vbCrLf & "Input the first letter of a word [A/B]"
1580 file_type = InputBox(msg, "file type")
1590 If file_type = "" Then GoTo input_end
1600
1610 input_name:
1620 msg = "Input the data file name without extension you wish
to save."
1630 file = InputBox(msg, "file name")
1640 If file = "" Then GoTo input_end
1650 file = """" & file & """"
1660 msg = "file name : " & file & vbCrLf & vbCrLf & "Do you
want to change the file name again?"
1670 ans = MsgBox(msg, vbYesNo)
1680 If ans = vbNo Then
1690 SCPI.Output "*CLS"
1700 If UCase(file_type) = "A" Then
1710 SCPI.Output "MMEM:STOR:TRAC:ASC " & file
1720 ElseIf UCase(file_type) = "B" Then
1730 SCPI.Output "MMEM:STOR:TRAC " & file
1740 End If
1750 SCPI.Output "SYST:ERR?"
1760 SCPI.Enter err_no, "#"
1770 SCPI.Enter err_mes
1780 If err_no <> 0 Then
1790 MsgBox (err_mes & "occured")
1800 GoTo input_name