Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling the minimise button in Excel workbook
How can I prevent a user minimising the workbook?
I would also like to prevent them using the restore or close buttons (I have a close option on a custom menu bar). David |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling the minimise button in Excel workbook
This isn't simple. You need to create API calls to
control the way the OS draws the window containing the worksheet. For that, you need to know the classname Windows has for the type of window that is called by the application to provide the UI. The classnames vary from xl95, 97, 2K, and (afaik) XP. I can give you some pointers - which version are you using? -----Original Message----- How can I prevent a user minimising the workbook? I would also like to prevent them using the restore or close buttons (I have a close option on a custom menu bar). David . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling the minimise button in Excel workbook
Thanks Steve.
I would also like to prevent the user minimising or resizing the Excel application window (or reverse the action). Is this possible? David *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling the minimise button in Excel workbook
Thanks Romolus,
Would what you suggest prevent the user resizing the Excel application window? (I am now using Workbook_WindowResize with Wn.WindowState = xlMaximized to trap and reverse an attempt to resize the workbook window.) I am developing my appication with Excel 2002 and also preparing a version for Excel 97. Regards, David *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling the minimise button in Excel workbook
Hi David,
Would what you suggest prevent the user resizing the Excel application window? (I am now using Workbook_WindowResize with Wn.WindowState = xlMaximized to trap and reverse an attempt to resize the workbook window.) I am developing my appication with Excel 2002 and also preparing a version for Excel 97. In my opinion, you shouldn't attempt to control your users like this. Instead, your application should respond appropriately to their choice of window size and whether they want to close the application. Your users, for example, may have vision impairments and need a large window and large fonts to see what they're doing. Conversely, I may have a very high-resolution monitor, and the last thing I want is for you to force your application to take over the entire display. I may also want to go and work on something else for a while, minimising your application to the task bar while I'm doing that. Regards Stephen Bullen Microsoft MVP - Excel www.BMSLtd.co.uk |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
When I minimise an excel spreadsheet it disappears. | Excel Discussion (Misc queries) | |||
Minimise Excel after several minutes | Excel Discussion (Misc queries) | |||
Disabling Minimise/Restore Down buttons | Excel Programming | |||
disabling cells based on cmd button | Excel Programming | |||
Disabling font color button | Excel Programming |