LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problem trapping an error

Hello,
I am writing a function to show the error number and name
for errors found in an Excel worksheet cell. I am passing
the cell contents to the function "Show_Error_Number(Val1
as variant) and then working with the error in the
function. The first step is to capture and debug.print
the error number. However, I've been unable to actually
capture the number using Err.Number or Error.Type.
How can I do this.

My code is shown below.

Public Function Show_Error_Number(val1 As Variant)

If IsError(val1) Then

Debug.print val1 ' for #NUM! error this prints "Error
2036" but I am unable to work with it as a string

'Show_Error_Number = Err.Number ' doesn't work
Show_Error_Number = Error.Type ' doesn't work

Else

Show_Error_Number = 99999999

End If


Thanks

Keith


End Function

 
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 Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
error trapping flow23 Excel Discussion (Misc queries) 3 April 13th 06 04:51 PM
trapping error RobcPettit Excel Programming 2 January 30th 04 03:37 AM
Error Trapping Neil Excel Programming 1 January 5th 04 04:38 PM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 10:11 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"