SetValidationError Method [Word 2003 XML Reference] -- Microsoft Office Word 2003 XML Software Development Kit
SetValidationError Method [Word 2003 XML Reference]
Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.
expression.SetValidationError(Status, ErrorText, ClearedAutomatically)
expression Required. An expression that returns one of the objects in the Applies To list.
Status Required WdXMLValidationStatus. Specifies whether to set the validation status error text (wdXMLValidationStatusCustom) or to clear the validation status error text (wdXMLValidationStatusOK).
WdXMLValidationStatus can be one of the following WdXMLValidationStatus constants
wdXMLValidationStatusCustom |
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
Applies to | XMLNode Object
©2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp