Hi all hopefully a simple one for some of you but I just can't seem to get this sorted and my net searches for help have left me even more confused !
So I have a workbook that I want to force a user to have to click a button to close the workbook.
The only thing (apart from a worksheet) visible is the Excel title bar at the very top of a window containing the usual buttons to minimise, restore and close.
I have the code below set to a custom Exit button on a worksheet which works fine for what I need.
Logically I would say I need to disable the close button when the workbook opens so that a user can't do anything with it as they simply can't press it (perhaps a msgbox with "Button is disabled") If my logic is correct then I have the following code on Workbook Open, is there something I can add to this?
Many thanks in advance for any help or replies
Paul
So I have a workbook that I want to force a user to have to click a button to close the workbook.
The only thing (apart from a worksheet) visible is the Excel title bar at the very top of a window containing the usual buttons to minimise, restore and close.
I have the code below set to a custom Exit button on a worksheet which works fine for what I need.
VBA Code:
Sub ZZ_EXIT()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
Logically I would say I need to disable the close button when the workbook opens so that a user can't do anything with it as they simply can't press it (perhaps a msgbox with "Button is disabled") If my logic is correct then I have the following code on Workbook Open, is there something I can add to this?
VBA Code:
Private Sub Workbook_Open(
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"",False)"
.WindowState = xlMaximized
.CommandBars("Full Screen").Visible = False
.CommandBars("Worksheet Menu Bar").Enabled = False
.DisplayStatusBar = False
.DisplayFormulaBar = False
.DisplayScrollBars = False
End With
With ActiveWindow
.DisplayWorkbookTabs = False
.DisplayRuler = False
.DisplayHeadings = False
End With
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End sub
Many thanks in advance for any help or replies
Paul