title: XslCompiledTransform - Compile Error When Transforming XML Using XSLT Stylesheet
body: <p>I am trying to take a sheet in Excel and create an XML document using VBA then transform that document using a XSLT stylesheet. </p>
  
  <p>I have included the code below up to the point that I am having problems. </p>
  
  <p>When I try to create an object like so:</p>
  
  <pre><code>Dim transformer As XslCompiledTransform ' transform document
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Compile Error: User defined type - not defined
  </code></pre>
  
  <p>I was previously experiencing this error when defining </p>
  
  <pre><code>Dim objDom As DOMDocument
  </code></pre>
  
  <p>but referencing <a href="https://stackoverflow.com/questions/11245733/declaring-early-bound-msxml-object-throws-an-error-in-vba">this question</a> solved that problem for me. However, I cannot find anything similar for this case.</p>
  
  <p>Can someone explain to me if there is a reference that I need to include and how to find these in the future?</p>
  
  <p>Note: I am using the Visual Basic Editor in Excel 2003 to create this VBA macro</p>
  
  <pre><code>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
  
  '~~&gt; Creates root element
      Set objXMLRootelement = objDom.createElement("Project")
      objDom.appendChild objXMLRootelement
  
  
  '~~&gt; 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
  
  ...
  </code></pre>