Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Error converting xml to xls. How to correctly write the path to my file?

$
0
0

Task: convert xml to xls

Problem: When I run the program, nothing happens, and I expect the conversion .xml in .xls.

Question: How to write the path to my file? He looks like this:

C:\Program Files\new

Sub XMLTOCSV()
Dim f, p, s

p = "C:\Program Files\new\"
f = Dir(p & "*.xml")
s = 0

Application.ScreenUpdating = False
    Do While Len(f) > 0
        s = s + 1
        ConvertXMLtoXLS p & f, p & Replace(f, ".xml", "") & ".xls"
        f = Dir()
    Loop
Application.ScreenUpdating = True
End Sub

Sub ConvertXMLtoXLS(xmlFile, xlsFile)
Dim xlAppAs, xlBook

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.OpenXML(xmlFile, 2)
xlBook.SaveAs xlsFile, 6
xlBook.Close False
xlApp.Quit
End Sub

Viewing all articles
Browse latest Browse all 88835


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>