views:

117

answers:

1

I currently have a VB.NET dll that returns a jagged array of double. This is the declaration:

Public Function CalcMatching(ByRef dataArray1 As Object, 
    ByRef dataLen1 As Integer, ByRef dataArray2 As Object, 
    ByRef dataLen2 As Integer, ByRef matchingType As String) As Double()()

It works well inside VB.NET, but when I insert it into a VBA project, I noticed that after the execution of the funtion, while retrieving the data, the "Type mismatch' excpetion is raised inside VBA.

I searched over the internet, but I could not find a delcaration of a jagged array inside VBA. is that possible? If yes, how can I do it?

+1  A: 

Just a guess without seeing the calling VBA code, but I believe this is being caused by having ByRef arguments instead of ByVal. There is stronger type checking when using ByRef arguments which you can read about here.

Steve Danner
Steve, the parameters are not generating any problems, the issue is with the return type of the function, that is not accepted by VBA.
bbouzan