Hi, I have currently the following code to export an Excel Spreadsheet to a .txt file.
The problem is that the .txt file does not have the correct spacing.The columns are not aligned with their corresponding value.
Any help on how to keep formatting the same on the .txt file as in the excel spreadsheet?
Code:
'Saves the Activesheet to the Desktop as a text file with a different extension
Dim newFile As String, fName As String, gName, fileSaveName
fName = "TEST"
newFile = gName & " " & fName & " " & Format$(Date, "dd-mm-yyyy")
fileSaveName = Application.GetSaveAsFilename(newFile, "Text (MS-DOS) (*.txt), *.txt")
ThisWorkbook.SaveAs fileSaveName, xlTextMSDOS
End Sub
The problem is that the .txt file does not have the correct spacing.The columns are not aligned with their corresponding value.
Any help on how to keep formatting the same on the .txt file as in the excel spreadsheet?