View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Displaying error messages

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