Skip to content

Active error handler is ignored #11

@Ik-12

Description

@Ik-12

Thanks for this great utility. I hoped I could use it to fix the issue that Application.Run ignores the active error handler.
However, calling a function with this method suffers from the same problem. Please see below for a minimal reproducible example.

Any ideas if this could be made to work?

(Tested with MS Access 2019 16.0.10397.20021 64-bit)

Public Sub Test()

On Error GoTo ErrorHandler

Dim exampleModuleAccessor As Object
Set exampleModuleAccessor = GetStandardModuleAccessor("SomeModule", Application.VBE.VBProjects("SomeProject"))

' Brings up the Debug Dialog; expected behavior is to handle the error with the error handler
' (as happens if "TestCallback" is method of a real class module).
CallByName exampleModuleAccessor, "TestCallback", VbMethod
        
ErrorHandler:
If Err.Number <> 0 Then
	Debug.Print "Error handled."
	Err.clear
End If

End Sub

Public Function TestCallback()

Debug.Print "TestCallback called."

' Throw error
Debug.Print 1 / 0

End Function

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions