Specifications
196 Chapter 16 
ESA/PSA Programming Examples
Using Visual Basic® 6 to Transfer Binary Trace Data
ESA/PSA Programming Examples
 output = output & ResultsArray(x) & vbCrLf
 Next x
 ’Print Results to the Screen
 MsgBox (output)
 ’Store the results in a text file
 fnum = FreeFile() ’Get the next free file number
 Open "bintrace.txt" For Output As #fnum
 isOpen = True
 Print #fnum, output
 ’ Intentionally flow into Error Handler to close file
Error_Handler:
 ’ Raise the error (if any), but first close the file
 If isOpen Then Close #fnum
 If Err Then Err.Raise Err.Number, , Err.Description
 Exit Sub
VisaErrorHandler:
 Dim strVisaErr As String * 200
 Call viStatusDesc(defrm, status, strVisaErr)
 MsgBox "*** Error : " & strVisaErr, vbExclamation, "VISA Error Message"
 Exit Sub
End Sub










