Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Prevent Escape on Nonmodal Userform with Progressbar

Andy:

Private Sub UserForm_Activate()
With Application
.Interactive = False
.EnableCancelKey = xlDisabled
End With
End Sub

The above code approximates a modal form, which is what I needed.

I would have liked to allow the user to use the Escape key in addition to
being able to click on the Cancel button, but EnableCancelKey = xlDisabled
prevents me from trapping the keycode as well, so the following code does not
work.

Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = vbKeyEscape Then Unload Me
End Sub

I will try looking for a EnableCancelKey = xlErrorHandler workaround, but
ideally, I would like to run my user form with ShowModal = True.
Unfortunately, I havent found a way to display a progressbar control
correctly in a modal userform.

For the time being, this does the trick. Thank you for your suggestion.
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
Progressbar on userform for waiting querytable retrieving data from web [email protected] Excel Programming 4 July 11th 07 02:58 AM
ProgressBar control in Userform Charlie Excel Programming 7 October 21st 05 11:47 PM
NonModal Forms and Set Focus JimP Excel Programming 0 November 24th 04 02:56 AM
MODAL vs. NonMODAL JimP Excel Programming 5 November 18th 04 01:21 PM
using escape key to exit a userform heidi Excel Programming 3 June 4th 04 05:25 PM


All times are GMT +1. The time now is 11:45 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"