Macro code to bypass the excel's update message

accessfever

Registered User.
Local time
Today, 00:29
Joined
Feb 7, 2010
Messages
101
Hi all, I have an Excel macro to do the following tasks:
A. Open a file from local drive.
B. Then copy one of the tab to B file.
C. Repeat the same process 16 times to complete copying and pasting to B file.

The macro runs fine except I would need to click "Do not update" option whenever any of the 16 files are opened by the macro. I wonder if there is some code to bypass the update/not update dialog box?
 
Before using the SaveAs method set the DisplayAlerts to false
e.g. objXL.DisplayAlerts = False
Note: the objXL is an Excel.Applicaiton object variable.
Complete the code process

Afterwards, set the objXL.DisplayAlets = True

Sub CloseBook()
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub

Sub CloseBookDontSave() ' don't save changes example
ActiveWorkbook.Close savechanges:=False
End Sub

Sub Auto_CloseWithSave()
If ThisWorkbook.Saved = False Then ' checks to see if it is currently saved
ThisWorkbook.Save
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom