Does anyone know a way to read out the error text if an add-in procedure was started via Application.Run and this procedure triggers an error with Err.Raise?
Warning: long introduction for a short question, but I think it's necessary.
Starting situation:
The msaccess-vcs-addin can be used to call a procedure before exporting the source files (currently only one procedure within the application).
I modified the export code so that a procedure can be started from an Access add-in. (Note: Both add-ins are executed as a compiled version.)
This allows me to start an automatic test run, for example.
Result:
To make this work, I currently set the interface like this:
used in msaccess-vcs-add-in:
This basically works, but I don't like the interface, because although it is suitable for this particular case, it forces you to design every other add-in procedure in the same way.
At first I had the idea of simply triggering an error and passing on the text to be displayed as an error message.
Unfortunately, this does not work.
An error occurs, but the error description is not passed on. (The error number is passed on.)
Does anyone have any idea how I could get the error description?
Warning: long introduction for a short question, but I think it's necessary.
Starting situation:
The msaccess-vcs-addin can be used to call a procedure before exporting the source files (currently only one procedure within the application).
I modified the export code so that a procedure can be started from an Access add-in. (Note: Both add-ins are executed as a compiled version.)
This allows me to start an automatic test run, for example.
Result:
To make this work, I currently set the interface like this:
Public Function AutomatedTestRun(Optional ByRef FailedMessage As String) As Boolean
used in msaccess-vcs-add-in:
Code:
If Not Application.Run(ProcedureName, ExternalReturnErrorMessage) Then
Log.Error eelLoggedWarning, ExternalReturnErrorMessage, Mid(ProcedureName, InStrRev(ProcedureName, "\") + 1)
End If
This basically works, but I don't like the interface, because although it is suitable for this particular case, it forces you to design every other add-in procedure in the same way.
At first I had the idea of simply triggering an error and passing on the text to be displayed as an error message.
Code:
Public Sub AutomatedTestRun()
...
If Not Success Then
Err.Raise vbObjectError + 1234, "AccUnitLoader.AutomatedTestRun", FailedMessage
End If
End Sub
An error occurs, but the error description is not passed on. (The error number is passed on.)
Does anyone have any idea how I could get the error description?
Last edited: