I have two subs to disable some stuff ON ALL WORKSHEETS whenever workbook opens and enable them back ON ALL WORKSHEETS when the workbook is closed. I also have a CommandButton1, by clicking on which, the workbook should be saved without any alerts and excel application should quit. Also when the user clicks on the X to quit, the workbook should get saved without alerts.
Iam confused whether I should write this in ThisWorkbook or all Sheet modules.
Also which method is correct to call a sub: CALL, RUN or just write the name of the sub?
Will this affect any functionality of excel if the program is halted in between like computer freezing, killing the excel file or excel application process from task manager?
Please advice.
Sub DisableStuff()
With Application
.ScreenUpdating = False
.WindowState = xlMaximized
.DisplayStatusBar = False
.DisplayFormulaBar = False
End With
With ActiveWidow
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayVerticalScrollBar = False
End With
End Sub
Sub EnableStuff()
With ActiveWidow
ActiveWindow.DisplayVerticalScrollBar = True
ActiveWindow.DisplayHorizontalScrollBar = True
ActiveWindow.DisplayWorkbookTabs = True
ActiveWindow.DisplayHeadings = True
End With
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
.ScreenUpdating = True
End With
End Sub
Bookmarks