View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Compile error in hidden module

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



BernzG wrote:

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

--
BernzG
------------------------------------------------------------------------
BernzG's Profile: http://www.excelforum.com/member.php...o&userid=22949
View this thread: http://www.excelforum.com/showthread...hreadid=388193


--

Dave Peterson