ValidationErrorText Property

Microsoft Word Visual Basic

ValidationErrorText Property

Returns a String that represents the description for a validation error on an XMLNode object.

expression.ValidationErrorText(Advanced)

expression    Required. An expression that returns one of the objects in the Applies To list.

Advanced Optional Boolean. Indicates that the error text displayed is the advanced version of the validation error description, which comes from the MSXML 5.0 component included with Microsoft Word.

Example

The following example checks each element in the active document and displays a message containing the elements and attributes that do not validate according to the schema and a description of why.

    Dim objNode As XMLNode
Dim strValid As String
        
For Each objNode In ActiveDocument.XMLNodes
    objNode.Validate
    If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
        strValid = strValid & objNode.BaseName & vbTab & _
            objNode.ValidationErrorText & vbCrLf
    End If
Next

MsgBox "The following elements do not validate against " & _
    "the schema." & vbCrLf & vbCrLf & strValid & vbCrLf & _
    "You should fix these elements before continuing."