3 of 3 people found this helpful
Looks like you're missing a SQCSymbolDefinition object in your code, where you would go ahead and set these properties.
Following your code line 'Set objSQC = disp.Symbols.Add(pbSymbolSQC)', try adding the following lines of code:
Dim objNewDefinition As SQCSymbolDefinition Set objNewDefinition = objSQC.GetDefinition()
From there, you will be able to set you symbol properties:
With objNewDefinition .ChartType = sqcEWMA .KeepBadValues = False End With objSQC.SetDefinition objNewDefinition
You can find this in the complete code example in the PI SQC Programmer Guide, as part of the ProcessBook online help.
Thank you John!
It works perfectly!
Ok Gregor !
Another option is to hit 'F2' in the VBA editor (there's a menu option for this, but I don't remember it because I always use the keystroke). That brings up the VBA object browser. You can look through the various VBA types that PB defines and see all the properties and methods (even the undocumented ones that we add to support some of our own add-ins!)
If you are wondering why the error is "object does not support this property or method" (other than the fact that VBA error messages are usually fairly cryptic). "SQCSymbol" is both the name of the symbol and the name of the library it is in (this is because SQC was sold separately years ago). Therefore, since VBA has rather vague syntax rules, SQCSymbol.SQCSymbolDefinition is a type, but SQCSymbol.GetDefinition is a method of the SQCSymbol type (technically, the full type name is SQCSymbol.SQCSymbol). Confused yet?
So, SQCSymbol objects don't have a SQCSymbolDefintion property or method because SQCSymbolDefintion a separate type name and not part of the SQCSymbol type.
You can consult either the documentation or the object browser to see which is which.