I have the following code that saves the sheet as values into a new excel file (xlsx). I need to modify it so it saves it as a text file (tab delimited) instead. What do I need to change to make that happen? Thank you!
Sub Export_Sheets()
' Don't show confirmation window
Application.DisplayAlerts = False
Set wbk1 = ThisWorkbook
For Each sh In wbk1.Sheets
If sh.Name = "ShippingConfirmation" Then
Set wbk2 = Workbooks.Add
sh.Copy Before:=wbk2.Sheets(1)
wbk2.Sheets(sh.Name).UsedRange.Value = wbk2.Sheets(sh.Name).UsedRange.Value
wbk2.SaveAs Filename:=ThisWorkbook.Path & "/" & sh.Name & "txt"
wbk2.Close
End If
Next sh
' Allow confirmation windows to appear as normal
Application.DisplayAlerts = True
End Sub
Sub Export_Sheets()
' Don't show confirmation window
Application.DisplayAlerts = False
Set wbk1 = ThisWorkbook
For Each sh In wbk1.Sheets
If sh.Name = "ShippingConfirmation" Then
Set wbk2 = Workbooks.Add
sh.Copy Before:=wbk2.Sheets(1)
wbk2.Sheets(sh.Name).UsedRange.Value = wbk2.Sheets(sh.Name).UsedRange.Value
wbk2.SaveAs Filename:=ThisWorkbook.Path & "/" & sh.Name & "txt"
wbk2.Close
End If
Next sh
' Allow confirmation windows to appear as normal
Application.DisplayAlerts = True
End Sub