excel - How to change file format of multiple .xml files saved in a folder to .xlsx file format using VBA -


i trying convert multiple .xml files in folder .xlsx files. have on 100 files , tedious manually save each file .xlsx. thought of using macro. code here runs specific file, how make work files in folder.

sub macroconvt() ' ' macroconvt macro '  '     chdir _         "s:\research , analysis\interns\2016\summer\new rca macro\layout files\converted excel files"     activeworkbook.saveas filename:= _         "s:\research , analysis\interns\2016\summer\new rca macro\layout files\converted excel files\firm_limit excessive hours_19jul16.xlsx" _         , fileformat:=xlopenxmlworkbook, createbackup:=false end sub 

thank you

use filesystemobject, this:

dim fso, tfolder, tfiles, tfile object dim fp string dim wb workbook  set fso = createobject("scripting.filesystemobject") ' create fso via late binding  fp = "put folder path here"  set tfolder = fso.getfolder(fp) ' set fso folder set tfiles = tfolder.files ' files collection  each tfile in tfiles          set wb= application.workbooks.open(tfile.path) ' open file         ' want workbook e.g. wb.saveas etc  next tfile 

Comments