Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error handling
I am quite new to VBA programming and I have come across a problem when
dealing with errors. Comming from a C++ background I am most familiar with exceptions and I was wondering if there is some way to "rethrow" an erro once it has been handled? Something like: Sub Foo() On Error GoTo E: Bar Baz Exit Sub E: If Err.Number = 11 Then Resume Next Else ReThrow Err End If End Sub Imagine for example that sometimes Bar will try to divide by zero, and if that happens it is safe to resume and execute Baz. But if some other kind of error should happen I do not want to handle it here. I know that I can use 'Error Err.Number' or Err.Raise to "create" a new error in the else-block, but while developing it would be nice to have the original error to simplify debugging (since the debugger can show me where the error occurred). -- Erik Wikström |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ADO Error Handling | Excel Programming | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Error Handling | Excel Programming | |||
Error handling with a handling routine | Excel Programming | |||
Error handling | Excel Programming |