将多个Excel工作表转换为.csv
我发现这个宏用于将工作簿中的多个excel工作表转换为单个命名的.csv文件,但不知道如何从转换的文件名中删除工作簿名称。我确信这很简单,但我对VBA一无所知。 Sub exportcsv() Dim ws As Worksheet Dim path As String path = ActiveWorkbook.path & "\" & Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1) For Each ws In Worksheets ws.Copy ActiveWorkbook.SaveAs Filename:=path & "_" & ws.Name & ".csv", leFormat:=xlCSV, CreateBackup:=False ActiveWorkbook.Close False Next End Sub