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.