1、调出文件扩展名
2、新建.xlsm的VBA工作表
新建一个工作表,另存为.xlsm的格式。打开,【开发工具】--【Visual Basic】--粘贴代码--运行。(注意文件夹的位置)
3、代码
Sub demo12()
Application.ScreenUpdating = False
Dim mypath, myfile As String
Dim sh As Worksheet
Dim wb, twb As Workbook
Set twb = ThisWorkbook
mypath = ThisWorkbook.Path & "\VBA练习\"
"注意替换上面【VBA练习】文件夹名称
myfile = Dir(mypath & "*.xlsx")
Do While myfile <> ""
Set wb = Workbooks.Open(mypath & myfile)
For Each sh In wb.Sheets
sh.Copy after:=twb.Sheets(twb.Sheets.Count)
Next
wb.Close True
myfile = Dir
Loop
Application.ScreenUpdating = True
End Sub