Working with the ValidationRuleSets collection
Validation Rules are grouped within ValidationRuleSets
. The UI provides the ability to import a built-in ruleset (Flowchart or BPMN 2.0) or a ruleset from another open Visio document, but the programmer can use the
Add(NameU as String)
or AddCopy(RuleSet as ValidationRuleSet[, NameU])
methods to create a new one.
The following code could be run from the Immediate window in VBA:
Visio.ActiveDocument.Validation.RuleSets.Add "bVisual"
You can retrieve a ruleset by its index
position in the collection, using ValidationRuleSets.Item(index)
, or by its ID using ValidationRuleSets.ItemFromID(ID)
. Once you have retrieved a ruleset, you can read its Name (this can be edited to be a localized version), NameU, Description (displayed as the tool tip in the UI), or check if the RuleSets
is enabled for validation.
The RuleSetFlags
value determines if the ruleset is visible in the Rules to Check dropdown in the UI, shown as follows:
The default value...