Need to fix code for merging books in one book - Repair Save Promt

Below is the code for combining several books into one book. However, this encourages the preservation of each transferred file.

I need the data to be transferred without interruption to save the files.

Your help is greatly 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 
+5
source share
2 answers

You might want to take a look at turning off display alerts to prevent alerts from appearing.

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

and back to use ...
Application.DisplayAlerts = True .

+3
source

Personally, I think that AddIn from the link below is much easier to work with and it handles all kinds of scripts, so I will hide what you described here, as well as many other things.

https://www.rondebruin.nl/win/addins/rdbmerge.htm

0
source

Source: https://habr.com/ru/post/1265403/


All Articles