Viewxl api definition – Measurement Computing DaqView User Manual
Page 85

987691
457-0913
rev
3.1
ViewXL API Definition
ViewXL provides a limited set of methods that you can use in your own Excel macros to leverage the
power of the Add-In. The methods below make up the ViewXL Programming API. If you use these
methods in your own Excel macros, there are certain precautions that you must take when designing your
programs.
If you start an acquisition, your program must periodically relinquish control so the ViewXL
Add-In can perform its internal tasks. If your macro is simple, like the example given in the
"Using the ViewXL Program API" section, then this is unnecessary. The sample macro is
called, directs ViewXL to perform two tasks; then exits. During an acquisition, ViewXL polls
the server every two seconds. Your macro must not run longer than this without releasing
control.
You must make certain that the currently running server can implement, or is compatible
with, the API call being made. For example, in the
example macro,
page vxl-9, we trusted that
the "exceltest.cfg" file was a valid configuration file for the currently running server.
You must ensure that the server is running before making a call that would be directed to it.
You can't call the server if it is not running, or has not been selected in the
Options
dialog
box.
The Options dialog box is discussed on page vxl-4.
Function vxlArmServer() As Boolean
This function Arms the acquisition. If the server is not currently loaded, it will be loaded and Armed. The
function returns True if successful, otherwise False. A False value will be returned if the server is already
Armed when the call is made.
Function vxlDisArmServer() As Boolean
This function disarms the server and aborts the acquisition. The function returns True if successful,
otherwise False. A False value will be returned if the server is already disarmed when the call is made.
Sub vxlConfig()
This method starts the server. A server must have been previously selected in the
Options
dialog box
before this call is made. The Options dialog box is discussed on page vxl-4.
Sub vxlLoadConfigFile(Optional ByRef sCfgFullPathName As String)
This method instructs the server to load the specified configuration file. The file name can not contain a
drive or path specification. If the file name is omitted from the call, the
Load Configuration dialog box
is
displayed, allowing you choose a configuration file. The Load Configuration dialog box is discussed on
page vxl-4.
Sub vxlUseDataDestination(Optional ByVal bState As Boolean)
This is used to enable or disable the use of the
data destination
worksheet cell. If a True or False value is
passed in the call, the data destination is enabled or disabled. If a value is omitted from the call, the data
destination state is toggled on and off. Data destination is discussed on pages vxl-3 and 4.
Sub vxlUseHeader(Optional ByVal bState As Boolean)
This is used to enable or disable the use of the
data header
. If a True or False value is passed in the call,
the data header is enabled or disabled. If a value is omitted from the call, the data header state is toggled
on and off. The data header is discussed on pages vxl-3 and 4.
Sub vxlSetDataDestination(ByRef wksCell As Range)
This sets the data destination to the worksheet cell identified by the Excel Range object reference passed
to the method. The Range object must not reference a range of cells that span multiple rows or columns.
For example, the following call would set the data destination to Row 3 and Column C; then enable
usage of the data destination.
VIEWXL.Interface.vxlSetDataDestination Range("C3")
VIEWXL.Interface.vxlUseDataDestination True
Public Function vxlIsServerReady() As Boolean
Returns True if the Server is in a state where it can receive commands from an Excel VBA program. The
Server would not be ready if it was busy performing a lengthy task, or if a message or dialog box that
requires user action is displayed.