ValidationRule.AddIssue Method (Visio)

Creates a new validation issue that is based on the validation rule, and adds it to the document.

Version Information

Version Added: Visio 2010

Syntax

expression .AddIssue([TargetPage], [TargetShape])

expression A variable that represents a ValidationRule object.

Parameters

Name

Required/Optional

Data Type

Description

TargetPage

Optional

Page

The page that has the issue. May be Nothing.

TargetShape

Optional

Shape

The shape that has the issue. May be Nothing.

Return Value

ValidationIssue

Remarks

TargetPage and TargetShape identify the specific object that is associated with the issue. If the object that you pass for either parameter is not a valid object, or if it is inconsistent with the rule's target type, Microsoft Visio returns an Invalid Parameter error.

If you do not pass a value for the optional TargetShape parameter, the validation issue target is the page.

If you do not pass values for either of the optional parameters, the validation issue target is the document.

Example

The following Visual Basic for Applications (VBA) example shows how to use the AddIssue method to add a custom validation issue to a validation rule and associate it with a particular shape on a particular page.

' Add a custom issue to the vsoValidationRule validation rule and 
' associate it with shape vsoShape on page vsoPage.
Set vsoValidationIssue = vsoValidationRule.AddIssue(vsoPage, vsoShape)