Hello,
Here is the full code:
Sub GetData()
Dim oXML As DOMDocument
Dim oXSL As DOMDocument
Dim oXML1 As DOMDocument
Dim oXMLNode As IXMLDOMNode
Dim oXMLNodes As IXMLDOMNodeList
Set oXML = New DOMDocument
Set oXML1 = New DOMDocument
Set oXSL = New DOMDocument
Dim rows As Integer
Dim cols As Integer
oXML.Load ("C:\Examples\distr_reports_schedule_t xml.xml")
oXSL.Load ("C:\Transforms\Untitled8.xsl")
Dim fileContent As String
fileContent = oXML.transformNode(oXSL)
Open "C:\Transforms\Prices.xml" For Output As #1
Print #1, fileContent
Close #1
oXML.async = False
oXML.Load ("C:\Transforms\Prices.xml")
rows = 2
cols = 1
Set oXMLNodes = oXML.SelectNodes("/Interest-List/Interest")
Debug.Print oXMLNodes.Length
ActiveSheet.Cells(1, 1).Value = "Date"
ActiveSheet.Cells(1, 2).Value = "Broker"
ActiveSheet.Cells(1, 3).Value = "Term"
ActiveSheet.Cells(1, 4).Value = "Best-Bid"
ActiveSheet.Cells(1, 5).Value = "Best-Offer"
For Each oXMLNode In oXMLNodes
For Each oXMLChildNode In oXMLNode.ChildNodes
If cols <= oXMLNode.ChildNodes.Length Then
ActiveSheet.Cells(rows, cols).Value = oXMLChildNode.Text
cols = cols + 1
End If
Next
cols = 1
rows = rows + 1
Next
End Sub
|