I’d like to create a special button in my excel file that saves the file as TSV automatically
can anyone help me with this.. a guide or point me to the right direction. Thank you.
I’d really appreciate your help.
Thank you!
This should work, just change the path
Sub test()
ActiveWorkbook.SaveAs Filename:="C:\Users\User\Desktop\Book1.tsv", _
FileFormat:=xlText, CreateBackup:=False
End Sub
Answer:
This should work, and re-Enable the current real workbook
Sub tsv()
' save the current fileName for re-save later
BookName = ThisWorkbook.Path & "\" & ThisWorkbook.Name
' select the good Sheet.Range
Sheets("TSV-Sheet").Range("A1:N25").Select
' dont display alert when already exist
Application.DisplayAlerts = False
' save TSV file
ActiveWorkbook.SaveAs Filename:="C:\Users\User\Desktop\Book1.tsv", FileFormat:=xlText, CreateBackup:=False
' change the sheetName modified by previous SaveAs
ActiveSheet.Name = "TSV-Sheet"
' Resave the real WorkBook (because the current workbook is *.TSV)
ActiveWorkbook.SaveAs Filename:=BookName, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Application.DisplayAlerts = True
End Sub
Tags: excelexcel, file