Forum Discussion
Searching fo Excel macro to convert multiple TXT files to multiple Excel Workbooks ...
- Oct 18, 2019
Alas I found what I needed from the following weblink:
https://www.extendoffice.com/documents/excel/4615-excel-batch-convert-csv-to-xls-xlsx.html
Just needed to make a few minor changes to VBA: Convert CSV files to XLSX code for TXT files:xCSVFile = Dir(xSPath & "*.csv")
changed to
xCSVFile = Dir(xSPath & "*.txt")
ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".csv", ".xls", vbTextCompare), xlWorkbookDefault
changed to
ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".txt", ".xlsx", vbTextCompare), xlOpenXMLWorkbook
-Greg
Greg, please check this thread https://stackoverflow.com/questions/31606394/convert-csv-to-xlsx-using-command-line if helps
- Greg_MouningOct 02, 2019Copper Contributor
Thanks for your reply Sergei! I will review this link and let you know if it resolves my inquiry.
Best,
Greg- Greg_MouningOct 18, 2019Copper Contributor
Alas I found what I needed from the following weblink:
https://www.extendoffice.com/documents/excel/4615-excel-batch-convert-csv-to-xls-xlsx.html
Just needed to make a few minor changes to VBA: Convert CSV files to XLSX code for TXT files:xCSVFile = Dir(xSPath & "*.csv")
changed to
xCSVFile = Dir(xSPath & "*.txt")
ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".csv", ".xls", vbTextCompare), xlWorkbookDefault
changed to
ActiveWorkbook.SaveAs Replace(xSPath & xCSVFile, ".txt", ".xlsx", vbTextCompare), xlOpenXMLWorkbook
-Greg