Example in vba, Program examples – Teledyne LeCroy X-STREAM OSCILLOSCOPES Remote Control User Manual
Page 284

A
P P E N D I X
I :
Program Examples
278
ISSUED: February 2005
WM-RCM-E Rev D
EXAMPLE IN VBA
VBA is the programming language built in to many of the more recent Windows applications. It is a subset of
Visual Basic that makes using OLE Automation Servers and ActiveX Controls very simple. The following VBA
subroutine demonstrates how easy it is to connect to an X-Stream DSO and send remote commands to it.
_______________________________________________________
Sub LeCroyDSOTest()
Dim dso As Object
Set dso = CreateObject("LeCroy.ActiveDSO.1")
Call dso.AboutBox
Present the control's About box
Call dso.MakeConnection("IP:172.25.1.2")
Connect to the unit
Call dso.WriteString("DISP ON", 1)
Enable the internal display routine
Call dso.WriteString("TRMD AUTO", 1)
Set the trigger mode to AUTO
End Sub
_____________________________________________________
To enter the VBA editor in members of the Microsoft Office suite:
1. Select Tools → Macro → Visual Basic Editor menu item.
2. When the VBA window appears, select the Insert → Module menu item.
3. Copy the above example into the editor window that appears.
To execute:
4. Position the text cursor within the subroutine.
5. Either select the Run → Run Sub/UserForm or press function key F5.
§ § §
NOTE: For more information, see the ActiveDSO on-line Help. On-line
Help contains VisualC++ example, explanations of ActiveDSO Methods
and Properties.