Macro code to bypass the excel's update message (1 Viewer)

accessfever

Registered User.
Local time
Yesterday, 21:04
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?
 

Rx_

Nothing In Moderation
Local time
Yesterday, 22:04
Joined
Oct 22, 2009
Messages
2,803
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

Top Bottom