Databases Reference
In-Depth Information
Sub Origin_DDE_Sample()
Application.DisplayAlerts = False
pKaDataBook = Open_Template(excel_sheet_path$,
"c:\temp\junk.xls")
frm9OrigDDE.Show
End Sub
This subroutine suppresses any alerts Excel would generate, opens and saves the Excel Work-
book with the pKa data to a different name “c:\temp\junk.xls” (to prevent corruption to the original
Workbook), and opens the GUI shown in Figure 9.25.
The user must now select the type of function for fitting (mono or bis), a data set for fitting (if only
fitting one data set), and press either the “Fit All Datasets” button to fit all data sets, or the “DDE Curve
Fit” to fit a single data set. In the case of fitting a single data set, the following subroutine will be executed:
Sub Run_Sample()
Call Start_Origin(origin_path$, origin_sheet_path$,
vbMinimizedNoFocus)
Call Initiate_Conversation
Call Send_pH_Data
Call Send_Fitting_Data
Call Set_Initial_Parameters
Call Click_Button
Call Get_Parameters
Call Terminate_Conversation
End Sub
The Start_Origin subroutine opens up Origin using the Shell command, stores the task
ID of the Origin process it started, and returns the operating system's focus back to Excel using
the AppActivate command.
Sub Start_Origin(apppath$, projpath$, winstyle)
'Starts Origin Remotely, Stores its Task ID to Origin_TaskID
'apppath$ = Full path to Origin75.exe
'projpath$ = Full path of Project to Open when Origin Starts
(Optional)
'winstyle% - Window Focus and Style of Opened Object (Origin)
Dim pathname$
'A space must be placed between apppath$ and projpath$ and
'projectpath$ must be in "" (Chr$(34) = ")
pathname$ = apppath$ + " " + Chr(34) + projpath$ + Chr(34)
'WD98: WindowStyle Argument of Shell Function Ignored (Q178328)
'If the pathname argument is set to a document instead of a program,
'the windowstyle argument will have no effect.
Origin_TaskID = Shell (pathname$, winstyle)
'Since Shell windowstyle is ignored
'Use AppActivate to set focus back to Excel
AppActivate "Microsoft Excel"
End Sub
Search WWH ::




Custom Search