Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to correct code to merge workbooks in a single workbook - Eliminate Save Promt

Tags:

excel

vba

Below is a code to merge multiple workbooks to a single workbook. However, it's prompting to save each file that's being transferred.

I need the data to be transferred without interruption for saving files.

Your help is much appreciated.

Sub Merger()
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("C:\Users\Vincent\Desktop\856")

Set dirObj = mergeObj.Getfolder("D:\change\to\excel\files\path\here")

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
like image 596
Vincent Avatar asked Oct 17 '22 15:10

Vincent


1 Answers

Perhaps you should look into turning off display alerts to prevent notifications from appearing.

You can do this by turning it off using...
Application.DisplayAlerts = False

and back on using...
Application.DisplayAlerts = True.

like image 104
Brad Avatar answered Nov 15 '22 06:11

Brad