Class XMLNamespaces (Word VBA)

To use a XMLNamespaces class variable it first needs to be instantiated, for example


Dim xmls as XMLNamespaces
Set xmls = Application.XMLNamespaces

For Each

Here is an example of processing the XMLNamespaces items in a collection.


Dim xml As XMLNamespace
For Each xml In Application.XMLNamespaces
	
Next xml

Add

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

Add (Path, NamespaceURI, Alias, InstallForAllUsers)


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

Arguments

The following argument is required

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

Optional arguments

The following arguments are optional

NamespaceURI (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 (String) - The name of the schema as it appears on the Schemas tab in the Templates and Add-ins dialog box.

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

Count

Returns a Long that represents the number of XML namespaces in the collection.


Dim lngCount As Long
lngCount = Application.XMLNamespaces.Count

InstallManifest

Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.

For security purposes, you cannot install an unsigned manifest. For more information about manifests, see the Smart Document Software Development Kit (SDK) on the Microsoft Developer Network (MSDN) Web site.

InstallManifest (Path, InstallForAllUsers)


Application.XMLNamespaces.InstallManifest _ 
 "https://smartdocuments/simplesample/manifest.xml"

Arguments

The following argument is required

Path (String) - The path and file name of the XML expansion pack.

Optional arguments

The following argument is optional

InstallForAllUsers (Boolean) - True installs the XML expansion pack and makes it available to all users on a computer. False makes the XML expansion pack available for the current user only. Default is False.

Item

Returns an individual XMLNamespace object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.


Dim xml As XMLNamespace
Set xml = Application.XMLNamespaces(Index:=1)