I found this code online to convert .xml to .xlsx. Can someone please explain what I need to do to make this work for for me?
Here is what I am trying to convert:
From: C:\user\myoung\downloads\Dataminer.xml
To: C:\user\myoung\downloads\Dataminer.xlsx
Is this code saying to use two folders named xml Folder and convFolder
Where would these folders go?
Here is what I am trying to convert:
From: C:\user\myoung\downloads\Dataminer.xml
To: C:\user\myoung\downloads\Dataminer.xlsx
Is this code saying to use two folders named xml Folder and convFolder
Where would these folders go?
VBA Code:
Dim objFolder As Object
Dim objFile As Object
xmlFolder = "C:\Users\John\Documents\xml\"
convFolder = "C:\Users\John\Documents\xls\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(xmlFolder)
For Each objFile In objFolder.Files
If UCase(Right(objFile.Name, Len(XML))) = UCase(XML) Then
NewFileName = convFolder & objFile.Name & "_conv.xlsx"
Set ConvertThis = Workbooks.Open(objFolder & "\" & objFile.Name)
ConvertThis.SaveAs Filename:=NewFileName, FileFormat:= _
xlOpenXMLWorkbook
ConvertThis.Close
End If
Next objFile