I want the macros to be locked up when cells are locked up.

G

Guest

On my spreadsheet I check "Lock" for all cells. Then turn on the
"Protection" for the sheet. In this condition, no one can enter or change
any information in any of the cells. Also you cannot right click a Macro
control button and edit the Macro. This is great.

However, my Macro controls the operation of the spreadsheet.
When you click start, the operation begins and repeats the operation over
and over again continuously without stopping until you press "ESC". When you
press "ESC", the operation stops, as it should. Now in this stopped
condition, a window appears on the screen which (amoung other buttons)
contains the button "Debug".
Even when the Protection is on, you can click this button and it gives you
access to the Macro contents. You can change anything you want to, it is not
Protected.
Is there a way to Protect the contents of the Macro by preventing any access
when you click the "Debug" button?

I would appreciate any help you can give.
Thankyou
Ed
 
R

Ron de Bruin

Hi Ed

You can protect your VBA code in the VBA editior
Alt-F11
Tools>VBAproject properties
 
G

Guest

Hi Ron
Thanks for the response.
I looked at the "Tools > VBAproject Properties" and am unable to figure out
what the coding would be.
Could you give me sample entries that would protect VBA code?
Thankyou
Ed
 
T

Tom Ogilvy

There is not code associated with it. It is an option you select.

Also, you need look at the EnableCancelKey property to have better control
in your macro. You can then have code execute that will avoid the debug
message and exit more gracefully.
 
R

Ron de Bruin

Hi Ed

Om the protection tab fill in a password (two times) and mark "Lock project for viewing".
Then Save/Close/reopen the file

You can't do this with code (it is possible with Sendkeys but this is not reliable)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top