将标签保存为新工作表&重命名新文件中的选项卡

时间:2018-02-23 20:24:14

标签: excel vba excel-vba

我有这段代码将工作簿中的每个标签保存为新文件。

Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ActiveWorkbook.Sheets
    xWs.Copy
    Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
    Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

保存新文件后,我需要重命名"产品"在每种情况下,因为这是将文件导入另一个程序的要求。如果不单独打开每个新文件,这是否可行?

0 个答案:

没有答案