Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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



  #2   Report Post  
Posted to microsoft.public.excel.programming
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Messages msao Excel Worksheet Functions 4 November 17th 09 04:55 PM
Error messages DAE Excel Discussion (Misc queries) 6 June 12th 09 09:21 PM
Error Messages Jo Davis Excel Worksheet Functions 1 January 13th 06 12:04 PM
Error Messages mikel2634 Excel Worksheet Functions 0 May 21st 05 04:30 PM
Displaying Messages BillCPA Excel Discussion (Misc queries) 1 December 9th 04 06:03 PM


All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"