Working with the ValidationRules collection
Once you have a ruleset, you can review, amend, or add to the rules within it. You can add a rule using the ValidationRules.AddRule(NameU as string)
method. Note that NameU
is really for use in code, since it is the Description property that is displayed in the UI. NameU
that must be unique within the Rules
collection of the parent ValidationRuleSet
.
You can retrieve a rule by its index
position in the collection, using ValidationRules.Item(index)
, or by its ID
using ValidationRules.ItemFromID(ID)
. Once you have retrieved ValidationRule
you can read its NameU
and Description
or check whether the ruleset is ignored for validation:
Public Sub EnumerateRules()
Dim doc As Visio.Document
Dim ruleSet As Visio.ValidationRuleSet
Dim rule As Visio.ValidationRule
Set doc = Visio.ActiveDocument
For Each ruleSet In doc.Validation.RuleSets
If ruleSet.Enabled Then
Debug.Print "EnumerateRules for RuleSet : " & _
...