Create Plots/VBA

From ReliaWiki
Revision as of 15:34, 7 September 2016 by Kate Racaza (talk | contribs) (Created page with '{{Template:API}} ==Tutorial: Create a Probability Plot == Below is the VBA version of the tutorial. '''VBA''' {{APIPrefix|Sub}} Main() {{APIComment|'Cr…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
APIWiki.png



Tutorial: Create a Probability Plot

Below is the VBA version of the tutorial.

VBA

Sub Main()

  'Create a Weibull++ data set.  
   Dim WDS As New WeibullDataSet
   Call WDS.AddFailure(16, 1)
   Call WDS.AddFailure(34, 1)
   Call WDS.AddFailure(53, 1)  
   Call WDS.AddFailure(75, 1)
   Call WDS.AddFailure(93, 1)
   Call WDS.AddSuspension(120, 5)   

  'Analyze the data set using the 2-parameter Weibull distribution and  
  'the RRX analysis method. Keep all other analysis settings at default. 
   WDS.AnalysisSettings.Distribution = WeibullSolverDistribution_Weibull
   WDS.AnalysisSettings.Parameters = WeibullSolverNumParameters_MS_2Parameter
   WDS.AnalysisSettings.Analysis = WeibullSolverMethod_RRX
 
  'Analyze the data set. 
   Call WDS.Calculate()

  'Declare a new WAPlots object. 
   Dim WPlot As New WAPlots

  'Add the analyzed data set to the plot. 
   Call WPlot.AddDataset(WDS)

  'Create a probability plot and display it in an Image control in the current Excel sheet. 
   Image1.Picture = WPlot.CreatePlotVB6(WAPlotType_Probability)

  'Resize the picture (optional). 
   Image1.Height = 600
   Image1.Width = 865
 
End Sub