Vba: ( ms excel ), Public petracer as peanalyzer, Dim x as new vsengineeventsmodule – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual
Page 135: If petracer is nothing then, Set x.vseevents = vsengine

Teledyne LeCroy
Automation API for PETracer/PETrainer
130
VBA: ( MS Excel )
Public PETracer As PeAnalyzer
Public Trace As PeTrace
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 IPEVerificationScript
Dim ScriptName, fileToOpen As String
ScriptName = ThisWorkbook.Sheets("Sheet1").Cells(2, 2)
If PETracer Is Nothing Then
Set PETracer = New PeAnalyzer
If PETracer Is Nothing Then
MsgBox "Unable to connect to PETracer", vbExclamation
Exit Sub
End If
End If
fileToOpen = ThisWorkbook.Sheets("Sheet1").Cells(1, 2)
Set Trace = PETracer.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 ) handles 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