protect code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I password protected the VBProject. However, when there is an error and "debug" is clicked, it opens the code window. Is there a way to prevent this code window to show?
Thanks!
 
Myriam said:
I password protected the VBProject. However, when there is
an error and "debug" is clicked, it opens the code window.
Is there a way to prevent this code window to show?

Yes. Eliminate the errors in your code.
 
That's a stupid answer! If you don't know if it's possible to manually
disable the debug screen, then don't reply.
I have the same problem. I have an Excel workbook that contains several
sheets with numerous links to other sheets and even other applications. The
problem is that if one of my links don't work anymore (someone
renamed/moved/deleted the targetfile by accident), the debug message appears.
This isn't very helpfull for my users and if they click on "Debug" they can
see the code and even tamper with it. Is there a way to disable this debug
message box and replace it with a custom message box?
Please, usefull replies only!
:
 
I have to clarify a few things that i forgot to mention. Someone with the
same problem as me got an answer. Catch the errors with "on error goto..."
This works great, but in my case it may not be usefull. Why? The workbook I
mentioned wasn't made by me and contains a lot of links. The one who made the
workbook, made all of these links with macro's (even created a new module for
every link, go figure). Now if I want to use error handling, I need to edit
every link (module). That's just too much work. Can I manually shut down
(with some vb code) error messages like in Access?

Thanx!!!
 
Hi
AFAIK you can't disable errors globally in VBA. (Don't think you can do
this in Access either, but not sure about it). So yes the appraoch
would be to make your code error resistent with erro handlers and on
error goto errhandler statements. This way you can raise individual
messages, etc.

So in your case you probably have to edit every module and Harlan is
right that you have to eliminate all errors or at least prevent all
possible errors which could lead to this debugging screen.
 
Pardon me, Pain, but Harlan's answer is a correct one, given the minimal
amount of information you provided. Just because you don't want to hear
it doesn't make it stupid.

Another correct answer is that if you simply close the file and reopen
it, the Debug option will be dimmed and your users will only have the
choice of "End".

In any kind of corporate or commercial environment I've been exposed to,
this would be utterly unacceptable (which is why I would have given you
the same answer Harlan did), but it will meet the exact specification
you gave. However, with your new specification (replace the error
message with a custom message box), AFAIK, that's not possible.

I suspect you didn't really test what your users' experience was,
otherwise you would have discovered that protecting your code in fact
works just fine - it's simply that the code remains unlocked during the
session in which you lock it.

Note: You should recognize that VBA Protection, while not quite as weak
as Worksheet or Workbook protection, is extremely easy to bypass. Using
it to prevent inadvertent changes makes sense. Using it to keep users
from seeing your code makes sense only for users who are too
unsophisticated to find these newsgroups.
 
Hi again,

You are propably right. I apoligize Harlan. I may have been a little rude.
It's just very frustrating to see what a mess this workbook is (in terms of
coding). The one who made the document is really inexperienced in making
macro's or coding. I can't blame him for that of course, he did his best. But
it's a mess to clean all errors. Especially if you can't make sure that no
errors will return. As I said, the workbook contains many many links to other
documents. If one of those documents (name) is changed or moved/deleted, an
error will pop up. And I'm trying to surpress the errors so that users won't
be bothered by them and just get a message that the link is temporary down.
Guess there's no other good solution then to create error handlers for every
link. Pffff, this is going to take ages.
Anyway, I still want to thank you guys for replying and helping me. Again,
my apologies Harlan.

Greetz Pain
 
Back
Top