Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBA: Error handling

I have created a function that returns a string. When it fails, Excel
reports "#VALUE!". I would like to report my description of the error
instead. I have tried to use error handling, but it seems to be
ignored. In the area in which I "Try to do some useful Stuff", an error
occasionally occurs. The debugger shows that control does not transfer
to my ErrorHandler. Instead, execution ends immediately, and the cell
value is set to "#VALUE!".

Public Function myFunction() As String
On Error GoTo ErrorHandler

' Try to do some useful Stuff

myFunction = "RESULT"

FunctionExit:
Exit Function

ErrorHandler:
Err.Clear
myFunction = "My Error Description"
Resume FunctionExit

End Function

Thanks for your assistance!

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 Handling Kevin Excel Discussion (Misc queries) 4 June 19th 08 12:31 AM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error Handling Don Rouse Excel Programming 1 August 2nd 05 06:02 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
Error handling John Pierce Excel Programming 3 October 3rd 03 12:17 PM


All times are GMT +1. The time now is 03:01 PM.

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"