create excel file from xml file
create excel file from xml file
API Declarations
Imports Microsoft.Office.Interop
Rate create excel file from xml file
(1(1 Vote))
Dim xml As New XmlDocument
xml.Load("C:\bcptable.xml")
Dim node As XmlNode
Dim list As XmlNodeList
list = xml.SelectNodes("//General")
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.Attributes("File").Value
exsheet.Cells(xx, 2) = node.Attributes("Table").Value
Next
exbook.SaveAs("C:\took1.xls")
app.Visible = True
MsgBox("complete")
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
End
create excel file from xml file Comments
No comments yet — be the first to post one!
Post a Comment