I'm trying to export my workbook to a text file but my code adds quotes in the exported file if the cells has commas in it.
Below is my code. Any help is appreciated.
Sub ExportFile()
Dim wb As Workbook
Dim saveFile As String
Dim WorkRng As Range
Dim r As Long
On Error Resume Next
r = Worksheets("sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Set WorkRng = Range(Cells(2, 1), Cells(r, 99))
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set wb = Application.Workbooks.Add
WorkRng.Copy
wb.Worksheets(1).Paste
saveFile = Application.GetSaveAsFilename(InitialFileName:="output", fileFilter:="Text Files (*.txt), *.txt")
wb.SaveAs Filename:=saveFile, FileFormat:=xlText, CreateBackup:=False
wb.Close
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Current Output: Current Output
Desired Output: Desired Output