Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Prevent Excel VBA Code from being Interrupted

Hi:

I have a VBA code that is triggered when workbook is opened. If a user
interrupts the execution (say, by pressing ESC key) as the code is being
executed (code has multiple user authentication checks and reformmating and
hiding of sheets per user's access level), the user gets this "Code
Interruption Dialog" where they can click on End execution button. By
pressing End button, the user can get access to undesired sheets/cells. My
question is if I can stop this code interruption in Excel so that I can
prevent access to undesired sheets/cells. Any ideas?

Thanks
Rajeev
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Don't Bother: Prevent Excel VBA Code from being Interrupted

Found my answer through another Post
Application.EnableCancelKey = xlDisabled
in the the beginning of code to prevent it from being interrupted

Thanks anyway

"Rajeev" wrote:

Hi:

I have a VBA code that is triggered when workbook is opened. If a user
interrupts the execution (say, by pressing ESC key) as the code is being
executed (code has multiple user authentication checks and reformmating and
hiding of sheets per user's access level), the user gets this "Code
Interruption Dialog" where they can click on End execution button. By
pressing End button, the user can get access to undesired sheets/cells. My
question is if I can stop this code interruption in Excel so that I can
prevent access to undesired sheets/cells. Any ideas?

Thanks
Rajeev

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Prevent Excel VBA Code from being Interrupted

To prevent Cancellation, as first row of the _Open, use:
application.EnableCancelKey=False
then later reset it :
application.EnableCancelKey=True

Be aware that setting it to False can be a major problem if the code enters
an infinite loop, you have no way to stop it and get back to design mode.

For the "per user's access level", to prevent any problem of data
visibility, hide all data sheets as xlSheetVeryHidden before saving the book
so when it opens, nothing is visible, then after authentification, unhide the
right sheets.

Regards,
Sebastien

"Rajeev" wrote:

Hi:

I have a VBA code that is triggered when workbook is opened. If a user
interrupts the execution (say, by pressing ESC key) as the code is being
executed (code has multiple user authentication checks and reformmating and
hiding of sheets per user's access level), the user gets this "Code
Interruption Dialog" where they can click on End execution button. By
pressing End button, the user can get access to undesired sheets/cells. My
question is if I can stop this code interruption in Excel so that I can
prevent access to undesired sheets/cells. Any ideas?

Thanks
Rajeev

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Prevent Excel VBA Code from being Interrupted

Check out help on: Application.InterActive = False

This command effectively locks the keyboard and mouse. Use it with caution,
read help first.

"Rajeev" wrote:

Hi:

I have a VBA code that is triggered when workbook is opened. If a user
interrupts the execution (say, by pressing ESC key) as the code is being
executed (code has multiple user authentication checks and reformmating and
hiding of sheets per user's access level), the user gets this "Code
Interruption Dialog" where they can click on End execution button. By
pressing End button, the user can get access to undesired sheets/cells. My
question is if I can stop this code interruption in Excel so that I can
prevent access to undesired sheets/cells. Any ideas?

Thanks
Rajeev

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
Code execution has been interrupted LAF Excel Discussion (Misc queries) 2 February 21st 08 03:03 PM
code execution has been interrupted del Excel Discussion (Misc queries) 0 September 3rd 05 12:22 PM
code execution has been interrupted François Excel Discussion (Misc queries) 1 February 18th 05 11:06 PM
Code Execution Has been Interrupted Adrian[_7_] Excel Programming 0 July 30th 04 10:02 AM


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