I am trying to take a sheet in Excel and create an XML document using VBA then transform that document using a XSLT stylesheet.
I have included the code below up to the point that I am having problems.
When I try to create an object like so:
Dim transformer As XslCompiledTransform ' transform document
I get this error:
Compile Error: User defined type - not defined
I was previously experiencing this error when defining
Dim objDom As DOMDocument
but referencing this question solved that problem for me. However, I cannot find anything similar for this case.
Can someone explain to me if there is a reference that I need to include and how to find these in the future?
Note: I am using the Visual Basic Editor in Excel 2003 to create this VBA macro
Sub CreateXML()
'Variable to hold all rows in excel file
Dim rows As Variant
'Variables used to iterate through row array
Dim i As Integer
Dim j As Integer
'Create objects for manipulating XML
Dim objDom As DOMDocument
Dim objXMLRootelement As IXMLDOMElement
Dim objXMLelement As IXMLDOMElement
Dim objXMLattr As IXMLDOMAttribute
'Represents the top level of the XML source
Set objDom = New DOMDocument
'~~> Creates root element
Set objXMLRootelement = objDom.createElement("Project")
objDom.appendChild objXMLRootelement
'~~> Saves XML data to a file
objDom.Save ("C:\Users\JSLAMKIN\Desktop\test.xml")
'Create an instance of the DOMDocument class:
Dim xDoc As DOMDocument
Set xDoc = New DOMDocument
'Create the file as output
Dim output As DOMDocument
Dim transformer As XslCompiledTransform ' transform document
...