ValidationRuleSet.Rules property (Visio)

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

Syntax

expression. Rules

expression A variable that represents a ValidationRuleSet object.

Return value

ValidationRules

Example

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
       
    Next

End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.