XMLNode.SetValidationError method (Word)
Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.
Syntax
expression. SetValidationError
( _Status_
, _ErrorText_
, _ClearedAutomatically_
)
expression Required. A variable that represents a 'XMLNode' object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Status | Required | WdXMLValidationStatus | Specifies whether to set the validation status error text (wdXMLValidationStatusCustom) or to clear the validation status error text (wdXMLValidationStatusOK). |
ErrorText | Optional | Variant | The text displayed to the user. Leave blank when the Status parameter is set to wdXMLValidationStatusOK. |
ClearedAutomatically | Optional | 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. |
Remarks
To set custom error text, use the wdXMLValidationStatusCustom constant.
Example
The following example specifies custom validation error text.
Dim objNode As XMLNode
Set objNode = ActiveDocument.XMLNodes(1)
objNode.SetValidationError wdXMLValidationStatusCustom, _
"Error Text", True
See also
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for