Databases Reference
In-Depth Information
ThisWorkbook.ObjOrigin.LTVar("nlsf.cod")
'Set the first fitting parameter to 0.663
ThisWorkbook.ObjOrigin.LTVar("nlsf.p1") = 0.663
LTStr [Property] provides access to LabTalk string variables.
Syntax:
BSTR LTStr(BSTR name)
Examples:
'Query the name of the active dataset (%C in Labtalk Script)
ThisWorkbook.ObjOrigin.LTStr("%C")
'Put “abc123” in temporary string storage (%Z in Labtalk Script)
ThisWorkbook.ObjOrigin.LTStr("%Z") = “abc123”
Run [Method] allows the Origin session to finish current operations. It can be used after
calling a method that triggers lengthy auto update calculations in Origin. In many respects
it is similar to the DoEvents Function in Visual Basic.
Syntax:
Boolean Run()
Example:
'Wait for auto update computation in Origin to complete
ThisWorkbook.ObjOrigin.Run
Execute [Method] executes a LabTalk script in specified context.
Syntax:
Boolean Execute(BSTR script, [optional] VARIANT name)
'Executes a series of Labtalk Commands
bb = ThisWorkbook.ObjOrigin.Execute(“X1=0;X2=10,” “Graph1”)
'Executes the Script “Calcs” contained in the Worksheet named
“Results”
bb = ThisWorkbook.ObjOrigin.Execute(“Results!Calcs.run();”)
bb = ThisWorkbook.ObjOrigin.Execute(“X1=0;X2=10,” “Graph1”)
Will return True for success, and False for failure.
CopyPage [Method] replaces the clipboard with an image of the specified graph or layer.
Syntax:
BOOL CopyPage(BSTR name, [optional] VARIANT format, [optional] VARIANT dpi,
[optional] VARIANT colordepth)
9.10
EXAMPLE: CREATING A COM TOOL TO PERFORM
CURVE FITTING USING ORIGIN FROM EXCEL
Utilizing the Origin application objects, properties, and methods covered in the previous section,
it is possible to construct a project such as that shown in Figure 9.28. To do so, however, will
require that Excel reference a specific project in Origin designed for this purpose. For this example,
a sample project named “pKaCurveFitting.opj” has been constructed in Origin for the sole purpose
of interfacing with Excel using COM-based methodologies. This project consists of (1) a graph
utilized as a uniform plotting template named “FitResult,” (2) a Worksheet named COMFit that
contains two scripts attached to buttons that perform the curve fitting and the raw data utilized for
the curve fit, (3) a Worksheet named FitCurve that stores the fitted curve to the data consisting of
101 evenly spaced points.
Figure 9.29 shows the Origin pKa Curve Fitting Project that is included in the accompanying
CD-ROM under the folder \Chapter 9\Samples\Origin. If the user presses either the “mono fit” or
Search WWH ::




Custom Search