Sigma LBA-708 사용자 설명서

다운로드
페이지 281
2.  Go to the Visual Basic Editor.  On the Tools menu, select Macro, and then select Visual 
Basic Editor.  A new VBA window will open. 
3.  Reference the LBA-PC ActiveX server.  On the Tools menu, select References…  Scroll 
down until you see LbapcActiveX EXE.  Select the checkbox to the left of LbapcActiveX 
EXE
4.  For this example, we will use the LBA-PC ActiveX server in a form.  Create a new form.  On 
the Insert menu, select UserForm.  A form is displayed in a new window. 
5.  Add controls to the form such as Start/Stop/Ultracal buttons, etc. 
6.  Declare a variable to hold a LBA-PC ActiveX server object.  On the View menu, select Code.  
A new window appears with an outline of the UserForm_Click() subroutine.  At the top of 
the code window, above the UserForm_Click() Function, type “Dim WithEvents LbapcActiveX 
As LbapcX.LbapcActiveX” without the quotation marks. 
7.  Initialize the LbapcActiveX object and initialize communication with LBA-PC.  There are two 
list boxes at the top of the code window.  In the left list box, select UserForm.  In the right 
list box, select Initialize.  A new subroutine called UserForm_Initialize() is created.  In this 
subroubtine type “Set LbapcActiveX=New LbapcX.LbapcActiveX” without the quotation 
marks.  This statement creates a new LBA-PC ActiveX server object and assigns it to the 
LbapcActiveX variable.  On the next line, type “LbapcActiveX1.Open” without the quotation 
marks.  This statement initiates communication between the LBA-PC ActiveX server and 
LBA-PC. 
8.  Respond to LBA-PC ActiveX events.  In the left list box, select LbapcActiveX.  A new 
subroutine called LbapcActiveX_OnNewFrame() is created.  This subroutine is called every 
time the LBA-PC collects a new frame of data. 
9.  Do something during the event.  In LbapcActiveX_OnNewFrame() subroutine type 
“Range(“B2”).Value = LbapcActiveX.Results(0)” without the outer quotation marks.  This 
statement puts the frame Total result in cell B2. 
 
An example Workbook,  LbapcActiveXExample.xls, can be found in “ActiveX\Examples\Excel” directory 
under the LBA-PC installation directory. 
 
9.2.2 
Visual Basic (Visual Studio) 
In this section, Visual Basic refers to the Visual Basic part of the Microsoft Visual Studio family of 
development products. Follow these steps to use the LBA-PC ActiveX server in Microsoft Visual Basic: 
1.  Start a new Visual Basic project. 
2.  Reference the LBA-PC ActiveX server.  On the Project menu select References…  Scroll 
down until you see LbapcActiveX EXE.  Select the checkbox to the left of LbapcActiveX 
EXE
3.    Declare a variable to hold a LBA-PC ActiveX server object.  On the View menu select 
Code.  A new code window appears.  At the top, type “Dim WithEvents LbapcActiveX As 
LbapcX.LbapcActiveX” without the qutotation marks. 
4.  Initialize the LbapcActiveX object and initialize communication with LBA-PC.  There are two 
list boxes at the top of the code window.  In the left list box select Form.  An outline of the 
Form_Load() subroutine is placed in the code window.  .  In this subroutine type “Set 
LbapcActiveX=New LbapcX.LbapcActiveX” without the quotation marks.  This statement 
creates a new LBA-PC ActiveX server object and assigns it to the LbapcActiveX variable.  On 
Operator’s Manual 
 
LBA-PC 
 
Doc. No. 10654-001, Rev 4.10 
159