Excel VBA - LaunchSet methods used by IR Control Charts<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hello again. I looked at the "analysis" VB.NET sample at:
C:\Program Files\SAS\JMP\11\Samples\Automation\Visual Basic Samples\Analysis .NET\analysis.vb
Then, from the ControlChart_Click() procedure, I extracted code relating to IR charts (see below).
The code ran successfully...except for the 2 lines of code I added:
ccontrol2.LaunchSetIRChartParms(True, False, 2)
ccontrol2.LaunchSetKSigmaAlphaH(True, False, False, 3.0, 1.0)
Please advise on the correct syntax. Thanks!
'----------------------------------------------------------
'Analysis > Control Chart > IR > Individual Measurement
'----------------------------------------------------------
Sub ControlChart()
Dim app As JMP.Application
Dim doc As JMP.Document
Dim dt As JMP.DataTable
Dim ccontrol2 As JMP.ControlChart
'Start JMP
Set app = CreateObject("JMP.Application")
app.Visible = True
'Access document and retrieve pointer to underlying data table.
Set doc = app.OpenDocument("C:\Program Files\SAS\JMP\11\Samples\Data\Big Class.jmp")
Set dt = doc.GetDataTable
'Bring the data table to the foreground and make it the active table.
dt.Activate
'Create a specific type of analysis object (e.g., ControlChart),
' which is used to specify columns and then launch the analysis.
Set ccontrol2 = doc.CreateControlChart
'Select column for charting on the vertical axis.
ccontrol2.LaunchAddProcess ("height")
'Select column whose values label the horizontal axis.
ccontrol2.LaunchAddSampleLabel ("age")
'Select column for By Group processing.
ccontrol2.LaunchAddBy ("sex")
'Select the chart type that you want from jmpControlChartConstants (e.g., IR).
ccontrol2.LaunchSetChartType ((JMP.jmpControlChartConstants.jmpControlChartIR))
'For the IR Chart, set Individual Measurement option and KSigma parameters.
ccontrol2.LaunchSetIRChartParms(True, False, 2)
ccontrol2.LaunchSetKSigmaAlphaH(True, False, False, 3.0, 1.0)
'Run the analysis with columns previously specified through LaunchAdd___.
ccontrol2.Launch
End Sub
Re: Excel VBA - LaunchSet methods used by IR Control ChartsThanks, Brian. Your testing of my code helped point me in the right direction.
I read about the syntax for calling subroutines:
- If you use the keyword "Call", you must enclose the argument list in parentheses.
- If you omit the keyword "Call", you must also omit the parenthesis surrounding the argument list.
So there are 2 correct ways to code this in VB:
Call ccontrol2.LaunchSetIRChartParms(True, False, 2)
Call ccontrol2.LaunchSetKSigmaAlphaH(True, False, False, 3#, 1#)
and
ccontrol2.LaunchSetIRChartParms True, False, 2
ccontrol2.LaunchSetKSigmaAlphaH True, False, False, 3#, 1#
Re: Excel VBA - LaunchSet methods used by IR Control ChartsHi JB,
I can't help you on this one. The methods that you mention above worked ok for me. What kind of error are you getting?
Brian Corcoran
JMP