View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Wrapping a XLL as if it were a DLL

I'm not sure you can declare xll functions as if a dll. In a quick test I
also get the same Error 49 message. Depending on the function, the error may
occur after the function has worked perfectly (on error resume next prevents
the msg). I suspect Application Run may be the only way to call xll
functions in VBA.

If you have the project files maybe you can rebuild as a dll and use Declare
Function etc.

Regards,
Peter T

"Maury Markowitz" wrote in message
...
Literally only seconds after posting I realized that I had typed in
the path with ".dll" instead of ".xll". Changing the extension made
THAT part work at least. Now I'm getting this:

Error 49, Bad DLL calling convention.

I sort of expected I would get something like this, but just to be
sure, does this mean I have written down the Private Declare Function
parameter list incorrectly? Assuming this is the case...

The XLL in question is passed a series of inputs that are represented
as ranges on a sheet. We have adapted this to use 2D arrays of Double
instead, which seems to pass into Application.Run just fine. But
here's where I'm lost: should I declare the inputs like...

..., dates() as Double, conventions() as Double, ...

or

..., dates as Any, conventions as Any, ...

or even

..., dates as Variant, conventions as Variant, ...

or maybe...

..., dates() as Variant, conventions() as Variant, ...

I *sort of* understand the differences between these (well, not sure
about the last two) but I can't say I *really* understand the nuances.
Is something:

Dim dates() as Double

passed into calls as a Variant? Or Variant()? Or is there a difference
in calling conventions between these?

Thanks!

Maury