使用macros将Excel文件保存为TSV

我想在我的Excel文件中创build一个特殊的button,自动将文件保存为TSV

任何人都可以帮助我这个..一个指导或指向我的正确方向。 谢谢。

我真的很感激你的帮助。

谢谢!

这应该工作,只是改变path

Sub test() ActiveWorkbook.SaveAs Filename:="C:\Users\User\Desktop\Book1.tsv", _ FileFormat:=xlText, CreateBackup:=False End Sub 

这应该工作,并重新启用当前的实际工作簿

 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