View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex T Alex T is offline
external usenet poster
 
Posts: 24
Default Coercing a variant into an array

Folks

I have the following problem

I need to call a function stored into a (third part) DLL that take as
parameter an array of doubles, i.e. it's declaration reads as

Function someFancyFunction(Todays_Date As Date, Data_Array() As
Double) as double

I new to write a "wrapper" VBA function that would be called as a
worksheet function with some parameters being named ranges and that
would eventually call my external, i.e. I'd like to write a formula
like

=SOME.FANCY.WRAPPER(TODAY(),MyNamedRange)

So my question is… how do I do this in an efficient way (an NO, I
can't call directly the DLL in this specific instance) ?

It seems that I have to declare my wrapper as

Public function SOME.FANCY.WRAPPER( prmDate as Date, prmRange as
variant) as double

And as such I will need to parse my variant and build the array by
code…

Is this the way to go or am I missing something obvious ?

Any pointer welcome

Regards

--alexT