XMLSchemaReferences.Add Method (Word)

Returns an XMLSchemaReference that represents a schema applied to a document.

Syntax

expression .Add(NamespaceURI, Alias, FileName, InstallForAllUsers)

expression Required. A variable that represents a XMLSchemaReferences collection.

Parameters

Name

Required/Optional

Data Type

Description

NamespaceURI

Optional

String

The name of the schema as defined in the schema. The Namespace parameter is case-sensitive and must be spelled exactly as it appears in the schema. If the specified namespace cannot be found in any of the schemas attached to the document, an error is displayed.

Alias

Optional

String

The name of the schema as it appears on the Schemas tab in the Templates and Add-ins dialog box.

FileName

Optional

String

The path and file name of the schema. This may be a local file path, a network path, or an Internet address.

InstallForAllUsers

Optional

Boolean

True if all users that log on to a computer can access and use the new schema. The default is False.

Return Value

XMLSchemaReference

Example

The following example attaches the specified schema to the active document. This example assumes that you have an xsd file located at the path specified in the FileName parameter.

Sub AddSchema() 
 Dim objSchema As XMLSchemaReference 
 
 Set objSchema = ActiveDocument.XMLSchemaReferences _ 
 .Add(, , "c:\schemas\simplesample.xsd", True) 
End Sub

See Also

Concepts

XMLSchemaReferences Collection

XMLSchemaReferences Object Members