Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Disable Cancel button

Is there anyway to cancel the "X" cancel button at the top of UserForms?
Alternatively, is there a way to re-route the "Esc" key to the "Done" button
on my userform?

The problem is that I have code that calls this form, and does an infinite
loop while checking the form's "IsDone" custom property. When the user
cancels the form, I get an "Automation Error", because the code calling the
form is still looking for a .IsDone property, but the object no longer
exists! I have tried putting setting the IsDone property to TRUE in the
Terminate event... but it does not work.

Or, is there another solution to this problem that I do not know about? Any
help would be appreciated!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Disable Cancel button

You can disable the 'X' button with the following code:

Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
Cancel = True
End Sub

You can make your Done button respond to the Esc key by setting
the Cancel property of the button to True.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"R Avery" wrote in message
...
Is there anyway to cancel the "X" cancel button at the top of

UserForms?
Alternatively, is there a way to re-route the "Esc" key to the

"Done" button
on my userform?

The problem is that I have code that calls this form, and does

an infinite
loop while checking the form's "IsDone" custom property. When

the user
cancels the form, I get an "Automation Error", because the code

calling the
form is still looking for a .IsDone property, but the object no

longer
exists! I have tried putting setting the IsDone property to

TRUE in the
Terminate event... but it does not work.

Or, is there another solution to this problem that I do not

know about? Any
help would be appreciated!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Disable Cancel button

Perfect. Thanks!


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
message box without ok or cancel button Subash Excel Discussion (Misc queries) 1 October 18th 05 10:38 AM
Cancel Button Matt Excel Programming 3 February 3rd 04 11:23 PM
Input Box Cancel Button rickylee Excel Programming 2 January 6th 04 11:43 PM
input box cancel button Ian Mangelsdorf Excel Programming 1 August 28th 03 09:05 PM
Button To Cancel Macro Bill Lunney Excel Programming 0 July 16th 03 10:27 PM


All times are GMT +1. The time now is 03:17 PM.

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"