Convert all Excel Files in a Folder to CSV with VBScript -
i'm new vbs scripting, , i'm trying automate converting series of excel documents (mixed xls, xlsx, , xlsm) csv. far code have written:
set ofso = createobject("scripting.filesystemobject") sfolder = ofso.getparentfoldername(wscript.scriptfullname) & "\excel_files\" dim oexcel set oexcel = createobject("excel.application") each ofile in ofso.getfolder(sfolder).files if ucase(ofso.getextensionname(ofile.name)) = "xls" or ucase(ofso.getextensionname(ofile.name)) = "xlsx" or ucase(ofso.getextensionname(ofile.name)) = "xlsm" dim obook set obook = oexcel.workbooks.open(ofile) wscript.echo("opened " & ofile.getname) obook.saveas ofso.getbasename(ofile) & ".csv", 6 wscript.echo("converted " & ofile.getname) obook.close false end if next oexcel.quit
when it's run, doesn't seem execute anything. appreciated.
Comments
Post a Comment