Databases Reference
In-Depth Information
Case True
Workbooks(pKaDataBook).Worksheets(1).Cells(13,
(Asc(frm9OrigDDE.TextBox_Array) - 64)).value =
RequestData (Channel, "nlsf.p3")
Workbooks(pKaDataBook).Worksheets(1).Cells(15,
(Asc(frm9OrigDDE.TextBox_Array) - 64)).value =
RequestData (Channel, "nlsf.cod")
frm9OrigDDE!pKa1TextBox.Text = RequestData (Channel,
"nlsf.p3")
frm9OrigDDE!codTextBox.Text = RequestData (Channel, "nlsf.cod")
Case False
Workbooks(pKaDataBook).Worksheets(1).Cells(13,
(Asc(frm9OrigDDE.TextBox_Array) - 64)).value =
RequestData (Channel, "nlsf.p4")
Workbooks(pKaDataBook).Worksheets(1).Cells(14,
(Asc(frm9OrigDDE.TextBox_Array) - 64)).value =
RequestData (Channel, "nlsf.p5")
Workbooks(pKaDataBook).Worksheets(1).Cells(15,
(Asc(frm9OrigDDE.TextBox_Array) - 64)).value = RequestData
(Channel, "nlsf.cod")
frm9OrigDDE!pKa1TextBox.Text = RequestData (Channel, "nlsf.p4")
frm9OrigDDE!pKa2TextBox.Text = RequestData (Channel, "nlsf.p5")
frm9OrigDDE!codTextBox.Text = RequestData (Channel, "nlsf.cod")
End Select
'Fetch Most Current Curve Fit Parameters - Write to Form (GUI)
End Sub
The next function will request the parameter specified. Notice that the requested parameter
must be treated as an array even if only a single parameter has been requested. A stronger form of
typecasting in VBA requires that all requested parameters be (1) treated as an array and (2) cast
as type Variant.
Function RequestData(Channel, param$) As Single
Dim returnList As Variant, i As Integer
'The stronger typecasting requires the returnList in DDE to be
'(1) cast as Variant (2) treated as array EVEN IF ONLY
REQUESTING A SINGLE ELEMENT
returnList = Application.DDERequest(Channel, param$)
For i = LBound(returnList) To UBound(returnList)
RequestData = Val(returnList(i))
Next i
End Function
Once Origin has finished the computations, and Excel has successfully requested the results
from the Origin computational engine, the DDE link between Excel and Origin should be closed.
The next subroutine terminates the DDE link at both ends. First, a DDE command is executed that
sends a Labtalk command to Origin to shut down its DDE connections, and then a command is
Search WWH ::




Custom Search