View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Will[_5_] Will[_5_] is offline
external usenet poster
 
Posts: 2
Default Displaying error messages

Thanks for that Chip, it worked a treat.

Regards
Will
-----Original Message-----
Will,

You can trap for the error, and display the error message

in your error
handling block. E.g,

Sub Test()
On Error GoTo ErrHandler:
'
' your code here
'
Exit Sub
ErrHandler:
MsgBox "The following error occured: " & vbCrLf & _
Err.Number & " - " & Err.Description
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com



"Will" wrote in message
...
Hi Folks

My apologies if this has been posted before - does

anyone
know of any code which I could use to display an error
message instead of the dreaded 'debug error' box?

I am able to display a message box which alerts the user
to the fact that an error has occured - can I show the
error within this message box?

Any help appreciated.

Thanks in advance.
Will



.