Board index » delphi » Passing Delphi Variant Arrays as parameters in Excel macros

Passing Delphi Variant Arrays as parameters in Excel macros

Hi

Does anyone know how I can pass an array of integers as a parameter in an
Excel Macro.

I have tried the following but I get a Type Mismatch error during runtime.

From Delphi:

VWidths := VarArrayCreate([0,10],varInteger);
....
....
OleVariant(xla).Run('DoReportSetup',VWidths);

In Excel my macro is declared as :

Sub DoReportSetup(iWidths As Variant)

Regards
Ramzan

 

Re:Passing Delphi Variant Arrays as parameters in Excel macros


Try passing varVariant as the 2nd parameter of VarArrayCreate.

Ron.

--
Ron Loewy - List of Articles -
http://members.home.net/rloewy/RonPubList.html

Quote
Ramzan Mulji <rmu...@channel4.co.uk> wrote in message

news:83of00$j7i10@forums.borland.com...
Quote
> Hi

> Does anyone know how I can pass an array of integers as a parameter in an
> Excel Macro.

> I have tried the following but I get a Type Mismatch error during runtime.

> From Delphi:

> VWidths := VarArrayCreate([0,10],varInteger);
> ....
> ....
> OleVariant(xla).Run('DoReportSetup',VWidths);

> In Excel my macro is declared as :

> Sub DoReportSetup(iWidths As Variant)

> Regards
> Ramzan

Re:Passing Delphi Variant Arrays as parameters in Excel macros


Quote
In article <83of00$j7...@forums.borland.com>, Ramzan Mulji wrote:

> I have tried the following but I get a Type Mismatch error during runtime.

> From Delphi:

> VWidths := VarArrayCreate([0,10],varInteger);
> .....
> .....
> OleVariant(xla).Run('DoReportSetup',VWidths);

> In Excel my macro is declared as :

> Sub DoReportSetup(iWidths As Variant)

Ramzan

Try

VWidths := VarArrayCreate([0,10],varVariant;

Roger Morton
roger.mor...@dial.pipex.com

Other Threads