I have a workbook which runs macros on the active workbook i.e. showing on the screen. When the macro finishes, I then close it. All works well, except the workbook with the macros flashes briefly on the screen before closing and then Excel shows the other (my 'active') workbook once more.
At the end of the macro I have coded these three VBA lines, where variable MyWorkBookName contains the name of the workbook with the macros in it. The workbook has already been saved so there are no unsaved changes at this point of the logic.
But the workbook (in string variable MyWorkBookName) still flashes briefly on the screen. -
Is there any way to avoid this flashing, or is it because I'm closing the workbook with the macros that are being run at the time and is unavoidable?
At the end of the macro I have coded these three VBA lines, where variable MyWorkBookName contains the name of the workbook with the macros in it. The workbook has already been saved so there are no unsaved changes at this point of the logic.
But the workbook (in string variable MyWorkBookName) still flashes briefly on the screen. -
VBA Code:
Application.ScreenUpdating = False
Workbooks(MyWorkBookName).Close ' get rid of me & my macros from this Excel environment ...
Application.ScreenUpdating = True
Is there any way to avoid this flashing, or is it because I'm closing the workbook with the macros that are being run at the time and is unavoidable?