Specifications
264 Chapter 16
Application Programs
Basic Measurement
Macro (E4991A VBA) Example Program
Example 16-2 and Example 16-3 show how a basic measuring program (E4991A VBA)
finds the self-resonance point of the inductor. The specifications for this application
program are in accordance with the aforementioned
“HTBasic example program” on
page 254. This program is saved under the filenames bsc_meas.lcr (macro program). The
structure and functions of the program are shown as follows.
NOTE For more on loading macros, see “Loading macros” on page 233.
In the main procedure (bsc_meas.bas in this example), when an event created in another
module (bsc_meas.cls in this example) is used, the event variable is defined as the Public
type in the class module (line 20 in
Example 16-3) and the object variable is stated and set
as follows in the main module (lines 50 - 60 in Example 16-2). Then the object variable is
disassociated from an actual object (line 1870 in Example 16-2).
Setting object
variables
•Dim variable As New Class name to be used
•Set object variable As New Library name to be used
Disassociating
object variables
•Set object variable = Nothing
NOTE End statement (lines 70, 140 and 210 in Example 16-3) is also used for disassociating
object variables.
NOTE When using an application other than the E4991A VBA, it is necessary to execute the
setting so that the E4991A library can be referred to and to activate the remote user
interface function before creating/executing the program. See
“E4991A Library” on
page 244 and Chapter 10 “Using Remote User Interface” in the E4991A Operation Manual
for details.
NOTE In order to execute a macro from the measurement screen of the E4991A without using the
Visual Basic editor, it is necessary to define the procedure as a Public type (line 20 of
Filename Type of module Object name Function
bsc_meas.bas module bsc_meas Procedure for basic measurement
bsc_meas.cls class module clsErr Event to end the program when
measurement failure occurs in the
analyzer.
Variable....................................... The user can specify any variable.
Class name to be used............... Class name (clsErr in this example) specified in
Name
property in the class module. The user can
specify any class name.
Object variable........................... Object variable property is defined by the user.
Library name to be used............ E4991A library (E4991ALib.Application)