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