ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing arrays from Excel (VBA) to C# uisng COM interop (https://www.excelbanter.com/excel-programming/406733-passing-arrays-excel-vba-c-uisng-com-interop.html)

jlea

Passing arrays from Excel (VBA) to C# uisng COM interop
 
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.



All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com