SillyWilly64
New Member
- Joined
- Jun 30, 2017
- Messages
- 4
Hi everyone, frequent reader, first time poster.
I have a question similar to that posted by user DougRobertson on March 30th.
I have also noticed that Excel 2016 seems to open multiple instances compared with Excel 2010. So here is the problem I need to solve. My code opens another workbook, makes a change to it and then saves and closes it. But, the flag "Application.DisplayAlerts = False" no longer works, so I get the usual unwanted prompt questions. Apparently VBA can't figure out which instance I'm referring to. So how do I open another workbook and get the correct "handle" to it so that the alerts will work?
Here is the code that works fine in 2010 but does not work in 2016
I have a question similar to that posted by user DougRobertson on March 30th.
I have also noticed that Excel 2016 seems to open multiple instances compared with Excel 2010. So here is the problem I need to solve. My code opens another workbook, makes a change to it and then saves and closes it. But, the flag "Application.DisplayAlerts = False" no longer works, so I get the usual unwanted prompt questions. Apparently VBA can't figure out which instance I'm referring to. So how do I open another workbook and get the correct "handle" to it so that the alerts will work?
Here is the code that works fine in 2010 but does not work in 2016
Code:
Workbooks.Open Filename:=file
wbkname = Right(file, Len(file) - InStrRev(file, "/"))
Set sourceSheet = Workbooks(wbkname).Worksheets(worksheet_tab)
sourceSheet.Activate
-- Do some Stuff --
Application.DisplayAlerts = False '<----- THIS LINE NO LONGER WORKS
ActiveWorkbook.Close SaveChanges:=True
Application.DisplayAlerts = True