This documentation is archived and is not being maintained.

ValidationRule.Delete Method (Visio)

Deletes the ValidationRule object from the document.

Version Added: Visio 2010

expression .Delete

expression A variable that represents a ValidationRule object.

Return Value

Nothing

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

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
Show: