Excel 2016中的macros

我正在使用下面的macros在Excel 2013中提取数据,现在我已经转移到Excel 2016.在Excel 2016中macros不起作用。

Sub simpleXlsMerger() Dim bookList As Workbook Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object Application.ScreenUpdating = False Set mergeObj = CreateObject("Scripting.FileSystemObject") Set dirObj = mergeObj.Getfolder("path") Set filesObj = dirObj.Files For Each everyObj In filesObj Set bookList = Workbooks.Open(everyObj) Range("A2:IV" & Range("A65536").End(xlUp).Row).Copy ThisWorkbook.Worksheets(1).Activate Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial Application.CutCopyMode = False bookList.Close Next End Sub 

有人可以帮我解决这个问题

尝试这个:

 Sub simpleXlsMerger() Dim bookList As Workbook Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object Application.ScreenUpdating = False Set mergeObj = CreateObject("Scripting.FileSystemObject") Set dirObj = mergeObj.Getfolder("path") Set filesObj = dirObj.Files For Each everyObj In filesObj Set bookList = Workbooks.Open(everyObj) 'EDIT With bookList.Sheets(1) .Range("A2:IV" & .Range("A65536").End(xlUp).Row).Copy _ ThisWorkbook.Worksheets(1).Range("A65536").End(xlUp).Offset(1, 0) End With '/EDIT bookList.Close False Next End Sub