Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default limit on DLL function arguments

I am extending a DLL that we have written for Excel VBA to call.

One of the new functions has 21 arguments. However, Excel
refuses to compile the VBA code and says that it cannot find
the function. Is there a limit on the number of arguments for
DLL functions in Excel VBA ?

Thanks,
Lynn McGuire


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default limit on DLL function arguments

Lynn,

The compile issue sounds like it might be something other than a parameter
issue. Are references set correctly and pointing to the right DLL. Do you
have binary compatability set when compiling the DLL? If not, your code
might be refering to an older version of the dll file.

Otherwise, I ran into this a while ago with a straight function call in VBA
between add-ins using Application.Run, which has a limit of 30 parameters.
The work around I put in place was to pass a collection object as one
parameter. The calling routine sets up the collection items one by one and
the called routine reads each collection item as a parameter. Long winded,
but it works.

HTH,

--
Robin Hammond
www.enhanceddatasystems.com


"Lynn McGuire" wrote in message
...
I am extending a DLL that we have written for Excel VBA to call.

One of the new functions has 21 arguments. However, Excel
refuses to compile the VBA code and says that it cannot find
the function. Is there a limit on the number of arguments for
DLL functions in Excel VBA ?

Thanks,
Lynn McGuire




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default limit on DLL function arguments

The compile issue sounds like it might be something other than a parameter issue. Are references set correctly and pointing to the
right DLL. Do you have binary compatability set when compiling the DLL? If not, your code might be refering to an older version of
the dll file.


I am building the DLL and then trying to use it. I have imported
a new BAS file for it to Excel VBA. Here is the def:

Declare Sub CalculateIsentropicCompressor Lib "DII2VBAS.DLL" _
Alias "_CalculateIsentropicCompressor@84" _
(ByVal NumberOfStreamsIn As Long, ByVal NumberOfStreamsOut As Long, _
ByVal NumberOfComponents As Long, ByVal padtodouble As Long, _
InletStreamTemperatures As Double, _
InletStreamPressures As Double, _
InletStreamMolarFlowrates As Double, _
InletStreamMolarFlowratesByComponent As Double, _
OutletStreamVaporFractions As Double, _
OutletStreamTemperatures As Double, _
OutletStreamPressures As Double, _
OutletStreamEnthalpies As Double, _
OutletStreamEntropies As Double, _
OutletStreamMolarFlowrates As Double, _
OutletStreamMolarFlowratesByComponent As Double, _
WorkAvailable As Double, _
IsentropicEfficiency As Double, _
PressureOutSpec As Double , _
CalculatedElectricalKwUsed As Double, _
CalculatedWorkUsed As Double, _
CalculatedIsentropicHead As Double)

Otherwise, I ran into this a while ago with a straight function call in VBA between add-ins using Application.Run, which has a
limit of 30 parameters. The work around I put in place was to pass a collection object as one parameter. The calling routine sets
up the collection items one by one and the called routine reads each collection item as a parameter. Long winded, but it works.


Here is the VBA call to my DLL. Fairly straight forward.

' compress to two outlet streams, vapor and liquid (if any)
CalculateIsentropicCompresssor Nin, Nout2, Ncomp, padtodouble, _
InletStreamTemperature(0), InletStreamPressure(0), _
InletStreamMolarFlowrate(0), _
InletStreamMolarFlowrateByComponent(0), _
OutletStreamVaporFraction(0), _
OutletStreamTemperature(0), OutletStreamPressure(0), _
OutletStreamEnthalpy(0), OutletStreamEntropy(0), _
OutletStreamMolarFlowrate(0), _
OutletStreamMolarFlowrateByComponent(0), _
WorkAvailable, IsentropicEfficiency, PressureOutSpec, _
CalculatedElectricalKwUsed, CalculatedWorkUsed, _
CalculatedIsentropicHead

Lynn


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default limit on DLL function arguments

Here is the VBA call to my DLL. Fairly straight forward.

' compress to two outlet streams, vapor and liquid (if any)
CalculateIsentropicCompresssor Nin, Nout2, Ncomp, padtodouble, _
InletStreamTemperature(0), InletStreamPressure(0), _
InletStreamMolarFlowrate(0), _
InletStreamMolarFlowrateByComponent(0), _
OutletStreamVaporFraction(0), _
OutletStreamTemperature(0), OutletStreamPressure(0), _
OutletStreamEnthalpy(0), OutletStreamEntropy(0), _
OutletStreamMolarFlowrate(0), _
OutletStreamMolarFlowrateByComponent(0), _
WorkAvailable, IsentropicEfficiency, PressureOutSpec, _
CalculatedElectricalKwUsed, CalculatedWorkUsed, _
CalculatedIsentropicHead


I retyped this entire DLL call from VBA and it started working. Weird.

Lynn


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default limit on DLL function arguments

As mentioned above, there is a limit to the number of parameters.
Perhaps you are calling the C/C++ function from your VBA code as a
means of creating a worksheet function out of a C/C++ DLL. The fastest
way to do this is through an XLL add-in. These use the Excel C API to
register user defined functions.

RapidXLL_NET automatically builds XLL add-ins ( as well as .NET
libraries ) from native C / C++ headers. Download a free trial at
http://www.RapidXLL.net The tool also allows a bit of customization.
You can default parameters and hide the them from worksheet users so
that the 21 parameter functions comes down to just 5 parameters. You
can also re-name the function in the process.

---
The RapidXLL Team
http://www.RapidXLL.net




T
Lynn McGuire wrote:
I am extending a DLL that we have written for Excel VBA to call.

One of the new functions has 21 arguments. However, Excel
refuses to compile the VBA code and says that it cannot find
the function. Is there a limit on the number of arguments for
DLL functions in Excel VBA ?

Thanks,
Lynn McGuire


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum function changes arguments Dianeg Excel Worksheet Functions 1 January 13th 10 02:25 PM
If Function with 3 arguments CIW Excel Worksheet Functions 5 December 5th 06 10:34 AM
How can I evade the limit of 30 arguments in a function? macca Excel Worksheet Functions 3 July 22nd 06 04:28 AM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
Is it possible to use more than 8 arguments in a function? Breesmom Excel Discussion (Misc queries) 1 December 21st 05 03:04 AM


All times are GMT +1. The time now is 11:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"