When the user opens my application, some tidying up is done:
This code works fine. It is when the user closes the workbook that I have problems. Either by clicking the X in the top right to close, or my programmed close button which calls a macro that runs """ ThisWorkbook.Close False """ The problem is that all of these locked down tidy-up items do not get reset. i stepped through the below code and each line runs, it just doesn't do anything.
Each of the lines in the ExcelReset macro runs as I step through the code, but the tabs don't appear, the status bar doesn't get reset, nothing. Looking for some expert direction, thanks.
Code:
Private Sub Workbook_Open()
shtMain.Activate
ExcelLockDown
End Sub
Sub ExcelLockDown()
With Application
.CellDragAndDrop = False
.CutCopyMode = False
.OnKey "^c", ""
.OnKey "^v", ""
.StatusBar = "Current User: (" & UCase(Environ("Username")) & ")"
End With
With ActiveWindow
.DisplayWorkbookTabs = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayHeadings = False
End With
End Sub
This code works fine. It is when the user closes the workbook that I have problems. Either by clicking the X in the top right to close, or my programmed close button which calls a macro that runs """ ThisWorkbook.Close False """ The problem is that all of these locked down tidy-up items do not get reset. i stepped through the below code and each line runs, it just doesn't do anything.
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
ExcelReset
Application.EnableEvents = False
shtLanding.Activate
Me.Saved = True
End Sub
Sub ExcelReset()
With Application
.ScreenUpdating = True
.EnableEvents = True
.CellDragAndDrop = True
.CutCopyMode = True
.OnKey "^c"
.OnKey "^v"
.StatusBar = False
End With
With ActiveWindow
.DisplayWorkbookTabs = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayHeadings = True
End With
End Sub
Each of the lines in the ExcelReset macro runs as I step through the code, but the tabs don't appear, the status bar doesn't get reset, nothing. Looking for some expert direction, thanks.