Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When I minimise an excel spreadsheet it disappears. Richard Excel Discussion (Misc queries) 1 April 13th 06 03:24 PM
Minimise Excel after several minutes Wayne_Perth_WA Excel Discussion (Misc queries) 1 May 26th 05 08:21 AM
Disabling Minimise/Restore Down buttons Scampa7[_2_] Excel Programming 1 October 25th 03 07:05 PM
disabling cells based on cmd button Consuelo Excel Programming 1 September 20th 03 09:44 AM
Disabling font color button Michael Singmin Excel Programming 1 September 16th 03 10:32 PM


All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"