ValidationRuleSet.Rules Property (Visio)

Returns the collection of validation rules in the validation rule set. Read-only.

Version Added: Visio 2010

expression .Rules

expression A variable that represents a ValidationRuleSet object.

Return Value

The following sample code is based on code provided by: David Parker

The following Visual Basic for Applications (VBA) example shows how to use the Rules property to get the names of all the validation rules in an existing validation rule set named "Fault Tree Analysis" in the active document. The example then prints those names in the Immediate window.

Public Sub Rules_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoValidationRule As Visio.ValidationRule
    Dim strValidationRuleSetNameU As String
    Set vsoDocument = Visio.ActiveDocument
    strValidationRuleSetNameU = "FaultTreeAnalysis"
    For Each vsoValidationRule In vsoDocument.Validation.RuleSets(strValidationRuleSetNameU).Rules
        Debug.Print vsoValidationRule.NameU

End Sub