I have a COM object 'Foo' that defines a function returning an array of Bar:
public Bar[] Bars()
{
return bars;
}
This is in a DLL that's registered with COM.
I can call this from VBA like so:
Dim aBars() As Bar
aBars = oFoo.Bars()
Dim oBar As Bar
Set oBar = aBars(0)
However, I need to call the same function from VBScript, which has no early binding support, and when I try this, it fails:
Dim aBars
aBars = oFoo.Bars()
Dim oBar
Set oBar = aBars(0) ' fails with 'Type Mismatch'
If I inspect the type of 'aBars', it is 'Unknown()', which I guess is why it doesn't know what to do with it.
What can I do to make this work?