I believe that you want this to again cause an error in the error handling code. Try something like this (not verified):
Private Sub Test On Error Goto bad x = 0 debug.print 1/x Exit Sub bad: 'Clean up code Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext End Sub
When using On Error Goto you need an Exit Sub before the label. Otherwise, your code will fall into the error handler, even if there are no errors.
Your first error handling does not detect actual errors that may occur at runtime other than what you are testing. In addition, there is no convenient way to notify the calling function that something went wrong if you did not add checks to all calling procedures.
Please note that it is usually considered a poor design, although it is used only for flow control to increase the error:
Private Sub Test If x = 0 Then Err.Raise End If End Sub
Ceres source share