LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Disable Button when no workbooks are open.

"Beto" wrote in message
...
Aaron Queenan wrote:

There is no workbook close event, only a workbook _before_ close event.

If
the workbook is modified, the user will see a dialogue, and can click
cancel. This means that there is no way to disable an icon in a timely
manner based on the workbook being closed.

What you could do, is set a timer to update a few times per second,

which
checks the active workbook - it will be null if none is open. If the

user
clicks the button immediately after closing the last workbook, just

ignore
the click - just as if it had been disabled.


Thanks for the reply, but it'll look like something is not working as it
should and I won't get the gray looking of disabled buttons (maybe I'm
being picky, but I like nice results). Actually, JE's code got the jobe
done.


No, the control would be disabled, so it would look the same as a disabled
button. The point of ignoring the click if the user manages to press the
button before the timer routine kicks in is so that the button always acts
disabled if no workbooks are open.

Try this with JE's code: Edit a workbook, click the close icon. You're
icon will disable. Click cancel. Your icon will be disabled even though
there is still a workbook open.

Regards,
Aaron Queenan.




 
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
Disable the save button leerem Excel Discussion (Misc queries) 4 December 10th 08 01:06 PM
Disable X button on excel pano Excel Worksheet Functions 6 March 28th 07 02:15 AM
Disable Close Button dan Excel Discussion (Misc queries) 5 September 22nd 06 07:39 PM
How do you disable the Collate button? Trixie Excel Discussion (Misc queries) 0 August 25th 06 04:00 PM
Disable Button Pete[_12_] Excel Programming 3 October 8th 03 01:30 PM


All times are GMT +1. The time now is 08:20 AM.

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

About Us

"It's about Microsoft Excel"