What are the limitations for parameters when calling C# methods from VBA code using COM interop?
I'm finding that if I call a method that takes a single simple type (string, int, etc) it works, but calling a method that takes a custom class as a parameter fails - with a 'Type Mismatch' error while compiling the VBA code.
C# code:
public namespace foo {
public class XXX { }
public class Service {
public setString(String val) { ... }
public setXXX(XXX val) { ... }
}
}
VBA Code:
Dim service As New foo.Service
service.setString("this works")
Dim complexClass as New foo.XXX
Rem This fails with a type mismatch error
service.setXXX(complexClass)
As mentioned above, the VBA compiler chokes on this line: service.setXXX(complexClass)
Any thoughts?