first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Code: General Error Handling Structure for a Function

Public Function basMyFunc() As Boolean

On Error Goto basMyFunc_Err

basMyFunc = True

'Code for function goes here.

basMyFunc_Exit:

'Clean-up code goes here.

Exit Function

basMyFunc_Err: Select Case VBA.Err 'Case <Err number> 'Add custom Error handling per case here. basMyFunc = False Resume basMyFunc_Exit Case Else VBA.MsgBox VBA.Err & ": " & VBA.Err.Description, _ vbCritical, "basMyFunc Error" basMyFunc = False Resume basMyFunc_Exit End Select End Function

mod date: 1998-10-29T20:50:40.000Z