Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Proper way to pass errors up the line
Whenever I post these questions I wonder what it's going
to look like to a Google user five years from now. So: "Hello from the past!" Now here is my VBA newbie question o' the day: How do I pass a raised error back to the procedure that called? Example (Don't laugh): Sub FirstProc() 'Code Code Code On Error Resume Next Call Second If Err.Number = vbObjectError + 513 Then msgbox "This error came from SecondProc" End if 'Code Code Code End First Sub SecondProc() 'Code Code Code Err.Raise Number:=vbObjectError + 513, Description:="I raised this error." End Sub This is obviously not correct, but hopefully you see what I'm trying to do. I want SecondProc to pass my error back to FirstProc and end without causing an error while in SecondProc. Then when FirstProc gets the error it displays a message or does something based on the err.number being my raised error. If I'm on the right track please show me where it's not working. If I'm waaaay off please tell me how to do it. tod |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Throwing Circular Errors When No Errors Exist | Excel Worksheet Functions | |||
Pass The Formulas Please | Excel Discussion (Misc queries) | |||
How to: Pass Command Line Parameter ??? | Excel Worksheet Functions | |||
pass fail | New Users to Excel | |||
Unresolved Errors in IF Statements - Errors do not show in results | Excel Worksheet Functions |