A user recently wanted to know how to convert an Excel file to a text file using a macro. You don’t need a macro unless you decide to do something very different like having only 9 spaces between two text values. For such kind of work you may need a macro. Even in such situations you may be able to find a solution without using a macro by using special data entry into Excel worksheet cells. You just use an appropriate number of ‘blanks’.
So you enter your data in an Excel worksheet according to your plans and then
- Click the Microsoft Office Button
- Select Save As…
- In the new ‘Save As’ dialog box or window you enter an appropriate file name
- In the ‘Save as type’ text box below the ‘File name’ you click the drop down arrow and choose ‘Text (Tab delimited) (*.txt)’ option
- Now your file has been saved as a text file which can be opened with a program like notepad
- You can also save the file as type ‘CSV (comma delimited)(*.csv)’
- When you open the CSV file with notepad it will show you text separated by commas. For example, if you had typed ‘Tom’ in cell A1 and ‘20000’ in cell B1, you can now see ‘Tom, 20000’ in the Notepad program.
Watch the Excel training video below to see the complete process of converting an Excel file to a text file and vice versa: