Re: strange arguments passing problem (from vba to fortran dll)



On 30 mei, 06:03, Brooks Moses <bmoses-nos...@xxxxxxxxxxxxxxxxxx>
wrote:
formulae translator wrote:
Thanks for Louis' reply
I found the reason by playing with VBA part.
I can NOT define more than one array in one line.
It's so strange because I never heard anyone mentioned this.

The adjusted code should be following:

Dim f_max, ppw As Double

Dim i, j, nt_out, nlayer, n_ma As Long

Dim control(7) As Long
Dim ma(100) As Long

[...]

I don't know very much about VBA, but looking at that syntax, I wonder
if the problem isn't that to define more than one array on the same
line, you'd have to do it like:

Dim control(7) As Long, ma(100) As Long

and that if you only do

Dim control(7), ma(100) As Long

then ma gets defined properly, but control gets typed as whatever VBA's
implicit typing is ("variant", I think).


Oh, a type "variant" would be a very bad idea!
It is a "polymorphic" type that only VB can handle properly -
a bit like array descriptors for assumed-shape arrays:
you can not (easily/portably) pass these to, say, C.

Quite likely that that is the problem.

Regards,

Arjen

.



Relevant Pages

  • Re: Evaluate a Name in Non-active WB
    ... using a variant array to get that into VBA? ... Peltier Technical Services, Inc. - http://PeltierTech.com ... Dim s As String ...
    (microsoft.public.excel.programming)
  • RE: LINEST - "Expression too complex"
    ... VBA does not support array arithmatic. ... Dim wsf As WorksheetFunction ... Dim intCounter As Integer ...
    (microsoft.public.excel.programming)
  • Re: Slow Macros in Excel 2007
    ... In windows excel VBA you would generally use ADO/DAO recordsets and ... You can also transfer a recordset directly to an array ... The Array function in VBA is oriented towards constants rather than data ... Worksheet using a *SINGLE* VBA instruction. ...
    (microsoft.public.excel.programming)
  • Re: Array Formulas in VBA
    ... I finally figured it out Jim. ... There's a "feature" in VBA that screws up the one particular case I happened to be using as an example. ... When using a Variant as an array, you have to declare the size ... Dim varArray As Variant ...
    (microsoft.public.excel.programming)
  • Retrieving Data: Speed of beating down rows vs retrieving from array?
    ... Got a "What If" area on a worksheet. ... Tom Ogilvy suggested vLookup which I guess is the standard way of ... VBA code doing the same thing? ... the array once when the workbook is opened, ...
    (microsoft.public.excel.programming)