[AccessD] OT: Passing an Array in VBA

Asger Blond ab-mi at post3.tele.dk
Sun Dec 19 18:04:13 CST 2010


Don't see why your code shouldn't work.
But BTW I don't like multidimensional arrays because you can't data type the dimensions.
When in need of an array with more than one dimension I always create a TYPE procedure to define a data type with the wanted dimensions and data types, then create a one dimensional array using that data type.
Don't know if this hurts performance compared to a multidimensional array - but it's simpler and (crucial) offers data constraint. Any objections?
Asger

-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] På vegne af Ralf Lister
Sendt: 19. december 2010 21:46
Til: accessd at databaseadvisors.com
Emne: [AccessD] OT: Passing an Array in VBA

Hello,

 

Sorry to bother with an Excel 2007 problem.

 

I try to pass an three-dimensional-array Werte(I, j. k) to a Procedure,
manipulate Werte() there. Then the manipulated Werte()-Array is passed again
to the main program.

 

My Code:

The main program

    Dim Werte(1 To 9, 1 To 42, 1 To 7) As Single

     ..

With Activesheet

    Select Case .Range("D" & "" & i + 1 & "").Value

        Case "ALICO"

            PopulateALICO Werte:=Werte, i:=1

        Case "ANTIGUA"

            PopulateANTIGUA Werte:=Werte, i:=1

         ...

    End Select

 

The called procedure

Sub PopulateALICO(ByRef Werte() As Single, i As Integer)

..

****************************************************************************
******

When I check in the main program, the array Werte() is still unmanipulated.

 

Saludos

Actuary Ralf Lister

La Paz, Bolivia

Registrado en ASFI

No. Registro: Act.Mat. 001

NIT: 1016725022

Skype Name: ralf.martin.lister

Tel.: 222 26 61, Cel. 70136531

rlister at actuarial-files.com

www.actuarial-files.com

Environment

 






More information about the AccessD mailing list