Passing arrays from Excel (VBA) to C# uisng COM interop

J

jlea

Hi - I'm using VS2005/Excel 2007 and can pass scalars from Excel to a C#
class exposed with [ClassInterface(ClassInterfaceType.AutoDual)] and setting
the assembly to Register for COM Interop and all works fine until I try to
pass an integer array from VBA to C#: I initially get "Function or interface
marked as restricted, or the function uses an Automation type not supported
in VB" and when I add "ref" to the C# function I get "Type mismatch: array
or user defined type expected".

Does anyone know what the trick to use to allow passing arrays (and ideally
other data types, objects, and returning various data types to Excel) from
Excel to a C# assembly?

Thanks.

Jon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top