Teledyne LeCroy UWBTracer Automation Manual User Manual
Page 71

LeCroy
UWBTracer Automation API Reference Manual
Manual Version 3.02
67
VBA: ( MS Excel )
Public UWBTracer As UwbAnalyzer
Public Trace As UwbTrace
Public GVSEngine As VScriptEngine
'
' VSEngineEventsModule – is a special class implementing VSE event handlers.
' It should have in global declaration section the line like this:
' Public WithEvents VSEEvents As VScriptEngine
'
Dim X As New VSEngineEventsModule...
Private Sub RunVScritButton_Click()
Dim VSEngine As VScriptEngine
Dim IVScript As IUwbVerificationScript
Dim ScriptName, fileToOpen As String
ScriptName = ThisWorkbook.Sheets("Sheet1").Cells(2, 2)
If UWBTracer Is Nothing Then
Set UWBTracer = New UwbAnalyzer
If UWBTracer Is Nothing Then
MsgBox "Unable to connect to UWBTracer", vbExclamation
Exit Sub
End If
End If
fileToOpen = ThisWorkbook.Sheets("Sheet1").Cells(1, 2)
Set Trace = UWBTracer.OpenFile( fileToOpen )
Set IVScript = Trace 'Get the IfcVerificationScript interface
Set VSEngine = IVScript.GetVScriptEngine( ScriptName )
' "Subscribe" for receiving VSE events – the X variable ( an instance of
VSEngineEventsModule class )
' will handle them.
'
Set X.VSEEvents = VSEngine
...
VSEngine.Tag = 12
' Assign a tag for VSE object
VSEngine.RunVScript ' Run verification script
Set X.VSEEvents = Nothing ' "Unsubscribe" for receiving VSE events
Set VSEngine = Nothing ' Release external
Set IVScript = Nothing ' objects...
End Sub