I have to convert 40+ pipe delimited .txt files to excel sheet(.xlsx). Also all the fields should be treated as text while converting it. Below is what I found best efficient manual way of doing it. Just assume I have files as sample1.txt to ... sampleN.txt.
1. Drag sample1.txt file to empty workbook. Then it creates new workbook with single sheet with sheet name same as sample1 copying all lines in file under column A.
2. Select column A and use text to column wizard.
3. Choose delimited file with pipe (|) delimiter and select text data type after selecting all column in next wizard tab. Then Finish.
4. File 'Save as' sample1.xlsx
After recording macro, I am able to do step 2 to 4 with single key combination. However "sample1" gets hard coded in macro. Hence every time I have to rename the saved file appropriately. Is there any way the file name can be taken based upon current sheet name during "save as"? Is there any better and easier way of doing all this? May be like a batch mode etc..