ValidationRule.Delete method (Visio)
Deletes the ValidationRule object from the document.
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
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.