I have a Form that makes a call to a method of an object variable. An error occurs in that method and I want to handle it in the form. If the call was to one of the form's own methods everything would work as I would want. As it is my error handler is never called and execution is halted. I can't imagine that this is there is no simple soution to this, but I can't find it. The smple code below illustrates the problem:
A Form that makes a method call on an object:
Private Sub Form_Load()
Dim T As New Test 'The object - see below
On Error GoTo HandleError
Debug.Print "Handling error in Foo call at top level" 'I never get here!
The object code:
Public Sub Foo(Divisor As Integer)
Dim X As Integer
X = 1 / Divisor 'Division by zero error occurs.