Class XSLTransforms (Word VBA)

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


Dim xsls as XSLTransforms
Set xsls = Application.XMLNamespaces(1).XSLTransforms

For Each

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


Dim xsl As XSLTransform
For Each xsl In Application.XMLNamespaces.XSLTransforms
	
Next xsl

Add

Returns an XSLTransform object that represents an Extensible Stylesheet Language Transformation (XSLT) added to the collection of XSLTs for a specified schema.

Add (Location, Alias, InstallForAllUsers)


Sub AddXSLT() 
 Dim objSchema As XMLNamespace 
 Dim objTransform As XSLTransform 
 
 Set objSchema = Application.XMLNamespaces("SimpleSample") 
 Set objTransform = objSchema.XSLTransforms _ 
 .Add("c:\schemas\simplesample.xsl") 
 
End Sub

Arguments

The following argument is required

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

Optional arguments

The following arguments are optional

Alias (String) - The name of the XSLT as it appears in the Schema Library.

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 XSLTransforms in the collection.


Dim lngCount As Long
lngCount = Application.XMLNamespaces(1).XSLTransforms.Count

Item

Returns an XSLTransform 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 xsl As XSLTransform
Set xsl = Application.XMLNamespaces(1).XSLTransforms(Index:=1)