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



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).

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
.



Relevant Pages

  • 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)
  • Re: Dictionary object: Error assigning user defined data type to item
    ... But, if you have a problem with an array, a simple ... workaround is to create a variant, redim it to an array and use the ... Dim x As Dictionary ... Excel, PowerPoint, and VBA add-ins, tutorials ...
    (microsoft.public.excel.programming)
  • Re: Detecting a running process.
    ... Private Declare Function EnumProcessModules Lib "psapi.dll" _ ... (ByVal dwProcessID As Long, _ ... Dim nProcesses As Long ... 'fill an array of longs with the ...
    (microsoft.public.vb.winapi)
  • Re: Updated datestamp doesnt work
    ... Public Sub StoreMyOldVals ... ' store values of current row in array ... Dim dbs As DAO.Database, rst As DAO.Recordset ... Dim var As Variant ...
    (microsoft.public.access.gettingstarted)
  • Re: Updated datestamp doesnt work
    ... Public Sub StoreMyOldVals ... ' store values of current row in array ... Dim dbs As DAO.Database, rst As DAO.Recordset ... Dim var As Variant ...
    (microsoft.public.access.gettingstarted)