Sub Copysheets_To_file()
Dim Path,file, year, Month, day As String
year = Format(Date, "YYYY")
Month = Format(Date, "MM")
' day = day(Date)
Path = ThisWorkbook.Path & "\" '打开的EXCEL文件所在的目录
file = "XX电器" & year & "年" & Month & "月" & "考勤表.xlsx" '新的工作簿文件
Worksheets(Array("考勤表1", "考勤表2")).Copy ' "考勤表1", "考勤表2"为工作表
Set wbNew = ActiveWorkbook
With wbNew
ActiveWorkbook.SaveAs filename:=Path & file
.Close
End With
End Sub