XMLNode.SetValidationError procedure builder

XMLNode.SetValidationError (Word)

Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.

To set custom error text, use the wdXMLValidationStatusCustom constant.

SetValidationError (Status, ErrorText, ClearedAutomatically)

Dim objNode As XMLNode 
Set objNode = ActiveDocument.XMLNodes(1) 
objNode.SetValidationError wdXMLValidationStatusCustom, _ 
 "Error Text", True


The following argument is required

Status (WdXMLValidationStatus) - Specifies whether to set the validation status error text (wdXMLValidationStatusCustom) or to clear the validation status error text (wdXMLValidationStatusOK).

Possible Values are wdXMLValidationStatusCustom, wdXMLValidationStatusOK.

Optional arguments

The following arguments are optional

ErrorText - The text displayed to the user. Leave blank when the Status parameter is set to wdXMLValidationStatusOK

ClearedAutomatically (Boolean) - True automatically clears the error message as soon as the next validation event occurs on the specified node. False requires running the SetValidationError method with a Status parameter of wdXMLValidationStatusOK to clear the custom error text.