SOLVED

Searching fo Excel macro to convert multiple TXT files to multiple Excel Workbooks ...

Copper Contributor

Hi, 

I wish to locate an Excel macro that will batch convert multiple TXT files to multiple Excel workbooks not single workbook like this:

http://rondebruin.nl/win/s3/win007.htm

Thanks for any assistance, 
Greg

5 Replies

@Greg_Mouning 

Hello! You've posted your question in the Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the Excel space - please post Excel questions here in the future. 

@Eric Starker 

 

Thank you Eric. I'm not very familiar with this new Microsoft Communities forum. :(

@Sergei Baklan 

 

Thanks for your reply Sergei! I will review this link and let you know if it resolves my inquiry.
Best,
Greg

best response confirmed by Greg_Mouning (Copper Contributor)
Solution

@Sergei Baklan 

 

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

1 best response

Accepted Solutions
best response confirmed by Greg_Mouning (Copper Contributor)
Solution

@Sergei Baklan 

 

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

View solution in original post