Search notes:

VBA Runtime 7: rtcErrObj

The VBA 7 runtime function rtcErrObj returns the err (error) object.
In the following example, the rtcErrObj function is accessed via the declare statement to assign an object (more precisely: the err object) to the objErr variable.
Then, the address to the IUnknown interface of errObj (which is returned by objPtr) is compared with the address of the same interface of err. Since both addresses are the same, we have showed that indeed both objects are the same.
option explicit

declare function rtcErrObj lib "VBE7.dll" alias "rtcErrObj"() as object

sub main() ' {

    dim objErr as object
    set objErr =  rtcErrObj()

    debug.print "objPtr(objErr) = " & objPtr(objErr)
    debug.print "objPtr(err   ) = " & objPtr(err   )

end sub ' }
Github repository about-VBA, path: /runtime-lib/VBE7/rtcErrObj.bas

Index