Disabling the minimise button in Excel workbook
David wrote:
How can I prevent a user minimising the workbook?
Preventing it is difficult but you can immediately reverse it.
Private Sub Workbook_WindowResize(ByVal Wn As Window)
If Wn.WindowState = xlMinimized Then Wn.WindowState = xlMaximized
End Sub
I would also like to prevent them using the restore or
close buttons (I have a close option on a custom menu bar).
If what you want to do is to keep it maximized and open, try:
Global gbOkToClose As Boolean
Private Sub Workbook_WindowResize(ByVal Wn As Window)
Wn.WindowState = xlMaximized
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If gbOkToClose = False Then Cancel = True
End Sub
Obviously, you need to set gbOkToClose to True in your close button
--
Steve Garman
|