Extract XML data using Excel

wayliff

Member
Joined
Feb 5, 2007
Messages
10
Programming Experience
Beginner
Hello

I have an xml file from which i'm trying to extract some unique nodes and I'm not having success doing so...so far I have written this

VB.NET:
If System.IO.File.Exists("C:\TaxData.xml") Then
            System.IO.File.Delete("C:\TaxData.xm")
        End If

        Try

            Dim xml As New Xml.XmlDocument
            xml.Load("C:\Taxdata.xml")
            Dim node As Xml.XmlNode
            Dim list As Xml.XmlNodeList

            list = xml.SelectNodes("/file/entity/jur/data/table/row/if/data")

            Dim app As New Microsoft.Office.Interop.Excel.Application
            Dim exbook As Microsoft.Office.Interop.Excel.Workbook
            Dim exsheet As Microsoft.Office.Interop.Excel.Worksheet
            exbook = app.Workbooks.Add
            exsheet = exbook.Sheets(1)
            Dim xx As Integer
            For Each node In list
                xx += 1
                exsheet.Cells(xx, 1) = node.InnerText
            Next
            app.Visible = True
            MsgBox("Export is Complete")
            Exit Sub

        Catch ex As Exception
            MsgBox(ex.Message.ToString)

        End Try

The routine seems to run ok however no values are returned.
Any guidance would be greatly appreciated
 
Xml looks ok, post a Xml file data sample that should have worked with that code.
 
Back
Top