Excel VBA:将多个工作表保存为新文件

Sub 创建文件()

'定义文本文件的名称
Dim file As String, arr, i

'指定文本文件的名称
file = ThisWorkbook.Path & "\需要复制的文件名.xlsx"

'在下面Array中列出所有需要复制的工作表的名称
Worksheets(Array("sheet1", "sheet2", "sheet3")).Copy
 
Set wbNew = ActiveWorkbook
 
With wbNew
 
    ActiveWorkbook.SaveAs Filename:=file
 
    .Close
 
End With
 
End Sub

你可能感兴趣的:(Excel,VBA,Excel)