Compile error in hidden module

B

BernzG

Hi,

I have password protected my excel macros and thus they are hidden fro
others that use it.

However when there is a 'compile error' I automaticly receive an erro
message
"Compile error in hidden module:Module1".

Is there any way that I can change that error message to read somethin
like this :-

"Complile error - contact Bernz and advise exactly what you were doin
at the time of the error message"

Cheers,
Bern
 
D

Dave Peterson

I don't think you can intercept this message and make it do what you want.

In fact, I don't think you can do much with a compile error.

But you could compile your project before you release it to others.

Inside the VBE
Debug|Compile VBAProject
 
K

keepITcool

recipient may still get the compile errors.
if he has a different excel version, or missing references to activex
objects/libraries)




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Dave Peterson wrote :
 
D

Dave Peterson

Good point.
recipient may still get the compile errors.
if he has a different excel version, or missing references to activex
objects/libraries)

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

Dave Peterson wrote :
 
B

BernzG

Hi,

Thanks for this.

Yes compile errors should be picked up in the first place when creating
and testing the macro - should have realised that.

I got it wrong in that I was wanting the intercept and replace a
"runtime" error message when a user does something that I have not
thought of or tested for.

Example of the error message:-

"Microsoft Visual Basic
Run time error ###########
Automation error
The error invoked has been disconnected from its clients"

Also exited completely out of Excel - stating reporting error

Can this message be replaced with my own message as stated previously.

Cheers,
Bernz
 
D

Dave Peterson

You could add some error handling to each sub:

option explicit
sub mysub()

on error goto errhandler:

'do lots of stuff

exit sub

errhandler:
msgbox err.number & vblf & err.description

end sub
 

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