XMLSchemaReferences object (Word)

A collection of XMLSchemaReference objects that represent the unique namespaces that are attached to a document.

Remarks

Use the XMLSchemaReferences property to return a collection of schemas attached to a document. The following example loops through the schemas attached to a document. If it finds the specified schema, it reloads it; if it doesn't find the specified schema, it attaches the schema to the document.

Sub VerifySampleSchema() 
 Dim objNS As XMLNamespace 
 Dim objSchema As XMLSchemaReference 
 Dim blnSchemaAttached As Boolean 
 
 For Each objSchema In ActiveDocument.XMLSchemaReferences 
 If objSchema.NamespaceURI <> "SimpleSample" Then 
 blnSchemaAttached = False 
 Else 
 objSchema.Reload 
 blnSchemaAttached = True 
 Exit For 
 End If 
 Next 
 
 If blnSchemaAttached = False Then 
 Set objNS = Application.XMLNamespaces.Item("SimpleSample") 
 objNS.AttachToDocument (ActiveDocument) 
 End If 
End Sub

Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Word Object Model Reference

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.