Class XmlNamespace (Excel VBA)

The class XmlNamespace represents a namespace that has been added to a workbook.

Item

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

Dim xmlnsp as XmlNamespace
Set xmlnsp = ActiveWorkbook.XmlNamespaces(Index:=1)

The following procedures can be used to set variables of type XmlNamespace: XmlMap.RootElementNamespace, XmlNamespaces.Item and XmlSchema.Namespace.

For Each

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

Dim xmlnsp As XmlNamespace
For Each xmlnsp In ActiveWorkbook.XmlNamespaces
	
Next xmlnsp

Prefix

Returns a String that represents the prefix for the specified XML namespace.

Dim strPrefix As String
strPrefix = ActiveWorkbook.XmlNamespaces(1).Prefix

Uri

Returns a String that represents the Uniform Resource Identifier (URI) for the specified XML namespace.

Dim strUri As String
strUri = ActiveWorkbook.XmlNamespaces(1).Uri

XmlNamespaces.Count

Returns a Long value that represents the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveWorkbook.XmlNamespaces.Count

XmlNamespaces.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).

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 - True installs the XML expansion pack and makes it available to all users on a machine. False makes the XML expansion pack available for the current user only. The default is False

InstallForAllUsers - True installs the XML expansion pack and makes it available to all users on a machine. False makes the XML expansion pack available for the current user only. The default is False

XmlNamespaces.Item

Returns a single XmlNamespace object from the collection.

Item (Index)

Index: The name or index number of the object.

Dim xmlnspItem As XmlNamespace
Set xmlnspItem = ActiveWorkbook.XmlNamespaces(Index:=1)

XmlNamespaces.Value

Returns a String value that represents the XML namespaces that have been added to the workbook.

If the workbook contains more than one namespace, the namespaces are separated by a blank space in the string returned by the Value property.

Dim strValue As String
strValue = ActiveWorkbook.XmlNamespaces.Value