VB and VBA Users Source Code: Preventing a user from interupting/debugging your VBA code
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Preventing a user from interupting/debugging your VBA code
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Tuesday, April 30, 2002
Hits:
1018
Category:
Unspecified
Article:
If you want to prevent a user from debugging your VBA code (eg. by pressing Ctrl + Break) you can use the EnableCancelKey property. Listed below are explanations of it's different states. 'Cancel key trapping is completely disabled. i.e. user cannot step into your code by pressing "Break". Application.EnableCancelKey = xlDisabled 'The current procedure is interrupted, and the user can debug or end the procedure (Default behavior). Application.EnableCancelKey = xlInterrupt 'The interrupt is sent to the running procedure as an error, trappable by an error handler set up with an On Error GoTo statement. The trappable error code is 18. Application.EnableCancelKey = xlErrorHandler
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder