次の方法で共有


XMLNode.ValidationErrorText Property

Word Developer Reference

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

Syntax

expression.ValidationErrorText(Advanced)

expression   A variable that represents a XMLNode object.

Parameters

Name Required/Optional Data Type Description
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.

Visual Basic for Applications
  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."

See Also