共用方式為


Validation.RuleSets Property (Visio)

Returns the collection of all the validation rule sets in the document. Read-only.

Version Information

Version Added: Visio 2010

Syntax

expression .RuleSets

expression A variable that represents a Validation object.

Return Value

ValidationRuleSets

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 RuleSets property to get the names of all the validation rule sets in the active document and print those names in the Immediate window.

Public Sub RuleSets_Example()

    Dim vsoDocument As Visio.Document
    Dim vsoRuleSet As Visio.ValidationRuleSet
    Dim vsoValidationRule As Visio.ValidationRule
    
    Set vsoDocument = Visio.ActiveDocument
    
    For Each vsoRuleSet In vsoDocument.Validation.RuleSets
    
        If vsoRuleSet.Enabled Then
            
            Debug.Print vsoRuleSet.NameU
            
        End If
    Next 
       
End Sub