Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Problem w/.EnableCancelKey = xlErrorHandler

I am runing XL97 in Win95.

I am trying to prevent a user from disabling a userform using
Ctrl-Break. I know how to stop him from clicking on the X but he can
still press Ctrl-Break and get out from the code..
I am using the code below to trap Ctrl-Break error 18 but it doesn't
work and I can't figure out why.

No matter what I do I don't seem to get it to go to the ErrorHandler
while UserForm1 is showing.

Thanks for any help.

'This is in ThisWorkbook
Private Sub Workbook_Open()
Call On_Open
End Sub

'This is in Module1
Private Sub On_Open()
On Error GoTo ErrorHandler
Application.EnableCancelKey = xlErrorHandler
UserForm1.Show
ErrorHandler:
If Err.Number = 18 Then
UserForm1.Hide
MsgBox "pressed break"
End If
End Sub



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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM


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