XMLNamespaces.Add method (Word)

Returns an XMLNamespace object that represents a schema that is added to the Schema Library and made available to users in Microsoft Word.

Syntax

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

expression Required. A variable that represents a '' collection.

Parameters

Name Required/Optional Data type Description
Path Required String The path and file name of the schema. This may be a local file path, a network path, or an Internet address.
NamespaceURI Optional String The namespace Uniform Resource Indicator as specified in the schema. The NamespaceURI parameter is case-sensitive and must be spelled exactly as specified in schema.
Alias Optional String The name of the schema as it appears on the Schemas tab in the Templates and Add-ins dialog box.
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

XMLNamespace

Example

The following example adds the specified schema to the Schema Library and then attaches it to the active document. This example assumes that you have a schema named simplesample.xsd at the specified path.

Sub AddSchema() 
 Dim objSchema As XMLNamespace 
 
 Set objSchema = Application.XMLNamespaces _ 
 .Add ("c:\schemas\simplesample.xsd") 
 
 objSchema.AttachToDocument ActiveDocument 
End Sub

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.