N
Neal Zimm
If an array is originally dim'd as: TestAy() as whatever
I can't find a way, in a subsequent macro where TestAy() is an argument,
to directly test whether or not it has been re-dim'd.
I have two macros, the first has a string array that is dim'd without
boundaries.
dim TestAy() as string
IF sub MacroOne puts values into it, I use:
redim TestAy(1 to Quantity) ' and then fill it with values.
Now, MacroTwo is called
call MacroTwo(TestAy())
sub MacroTwo(TestAy() as string)
' I've tried different ways, but keep getting subscript errors, when I try
to
' test whether or not TestAy has values without also creating and
' passing another argument showing whether or not TestAy was
' redim'd in MacroOne. Some examples follow of stuff that didn't work
' when MacroOne did NOT redim TestAy.
' NOTE: I'm looking for a direct way, if it exists, to learn. I know that
' I could redim TestAy(1) in MacroOne and then in MacroTwo test
' TestAy(1) to see what it contained.
if lbound(TestAy) > 0 then ..... ' errors out if not dimmed
dim Number
number = vartype(TestAy) ' tells me it's an array but no boundaries
Dim holdARRAY
holdARRAY = Array(TestAy)
MsgBox LBound(holdARRAY(1)) 'errors out if TestAy not redim'd.
end sub
Thanks for your help.
I can't find a way, in a subsequent macro where TestAy() is an argument,
to directly test whether or not it has been re-dim'd.
I have two macros, the first has a string array that is dim'd without
boundaries.
dim TestAy() as string
IF sub MacroOne puts values into it, I use:
redim TestAy(1 to Quantity) ' and then fill it with values.
Now, MacroTwo is called
call MacroTwo(TestAy())
sub MacroTwo(TestAy() as string)
' I've tried different ways, but keep getting subscript errors, when I try
to
' test whether or not TestAy has values without also creating and
' passing another argument showing whether or not TestAy was
' redim'd in MacroOne. Some examples follow of stuff that didn't work
' when MacroOne did NOT redim TestAy.
' NOTE: I'm looking for a direct way, if it exists, to learn. I know that
' I could redim TestAy(1) in MacroOne and then in MacroTwo test
' TestAy(1) to see what it contained.
if lbound(TestAy) > 0 then ..... ' errors out if not dimmed
dim Number
number = vartype(TestAy) ' tells me it's an array but no boundaries
Dim holdARRAY
holdARRAY = Array(TestAy)
MsgBox LBound(holdARRAY(1)) 'errors out if TestAy not redim'd.
end sub
Thanks for your help.