Compartir a través de


ValidationRule.Delete Method (Visio)

Deletes the ValidationRule object from the document.

Version Information

Version Added: Visio 2010

Syntax

expression .Delete

expression A variable that represents a ValidationRule object.

Return Value

Nothing

Remarks

Calling the Delete method also deletes all ValidationIssue objects that are associated with the validation rule.

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 Delete method to delete a validation rule named "Unglued Connector" from the validation rule set named "Fault Tree Analysis" in the active document.

' Delete a named rule from a named rule set.
Public Sub Delete_Example()

    Dim strValidationRuleSetNameU As String
    Dim strValidationRuleNameU As String

    Dim vsoValidationRuleSet As Visio.ValidationRuleSet

    strValidationRuleSetNameU = "Fault Tree Analysis"
    strValidationRuleNameU = "UngluedConnector"
    Set vsoValidationRuleSet = ActiveDocument.Validation.RuleSets(strValidationRuleSetNameU)
    
    ' Delete the rule.
    vsoValidationRuleSet.Rules(strRuleNameU).Delete
    
End Sub