-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
A Module is not a routine (Sub/Function). We do not pass parameters
between modules, but between routines in the modules. You can pass a
collection variable as you pass any other variable: as a parameter.
E.g.:
' inside a routine
Dim col As New Collection
...
col.Add "Fred"
col.Add "Harry"
MySub col ' <- the call to the other routine w/ the collection
---
' in another module
Public Sub MySub(MyCol As Collection)
' use the collection parameter
Dim nm As Variant
For Each nm In MyCol
Debug.Print nm
Next nm
End Function
Results (in debug window):
Fred
Harry
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQm1tEoechKqOuFEgEQKE5ACg1geSg/++CdXBKZ66HZ+AIRsEYkcAoI/g
jfJeqdCbu3XFQIk57pN8lqva
=8TgW
-----END PGP SIGNATURE-----
deko wrote:
This is a basic program flow question.
I'm trying to refractor an AC2000 app and split sections of code into
separate modules. But there are a number of collections I create in one big
module - containing file paths, Excel worksheet names, etc - I'm not sure
how to pass these around, or if I'd be better off saving things to a table
and using a recordset. My guess is a recordset would be slower.
For example, should I do something like this:
[form module]
If basA.Function1 Then
If basB.Function.2 Then
If basC.Function3
Else
'code
End if
Else
'code
End if
(but then how to pass collections between modules?)
or just daily chain the modules:
[basA]
'code
Call basB (colX)
[basB]
'code
Call basC (colY)
etc..