Try this in VBA to return the AddressOf ...
Public Function MyAddressOf(sFuncName As String) As Long
' This function Returns a function pointer of a VBA public function.
' Since the VB AddressOf operator which is not supported in VBA, call this
' function passing in the name of the function you want the pointer to.
' Generic return result so we can test our function calls for errors
Dim lResult As Long
' To hold the handle to the current project
Dim lHproject As Long
' To hold the ID of our function name as it is known by the system
Dim sFuncID As String
' To hold the final result (the return value of MyAddressOf)
' It is the same as if we had used the standard VB AddressOf function
' but remember, that is not supported in VBA
Dim lFuncPtr As Long
' The function name you passed in when you called MyAddressOf needs
' to be converted to Unicode in order for it to be found by GetFuncID
' This will hold that conversion
Dim sFuncNameUnicode As String
' Convert the passed in function name (the one we want the address of) to Unicode
sFuncNameUnicode = StrConv(sFuncName, vbUnicode)
' Get the current VBA project handle
Call GetCurrentVbaProject(lHproject)
' Make sure we got a project handle
If lHproject <> 0 Then
' Get the VBA function ID (this is the ID of the function we passed in to MyAddressOf)
lResult = GetFuncID(lHproject, sFuncNameUnicode, sFuncID)
' Again, check for an error so we don't try to get a pointer to
' a non-existent function.
If lResult = NO_ERROR Then
' Get the function pointer.
lResult = GetAddr (lHproject, sFuncID, lFuncPtr)
If lResult = NO_ERROR Then
' Return the pointer to the function we passed in
MyAddressOf = lFuncPtr
End If
End If
End If
End Function
You will need to replace the AddressOf call in the code with MyAddressOf to make it work....