MWE
08-22-2005, 06:20 AM
I have a question about dynamic arrays:
assume strX is a dynamic array of type string and is dimed in Sub A. Sub A calls Sub B and one of the passed arguements is strX. For example:
Sub A
Dim strX() as string
Call Sub B ( ... , strX , ...)
End Sub
Obviously strX can be ReDimed in Sub A, but can it be ReDimed in Sub B? VBA Help states "Used at procedure level to reallocate storage space for dynamic array variables." But it is not clear that this means "only at the "level" where the variable was initially declared". Trying to do this does not create a "compile" error, but does create an execution error (at least the way(s) I have tried doing this).
assume strX is a dynamic array of type string and is dimed in Sub A. Sub A calls Sub B and one of the passed arguements is strX. For example:
Sub A
Dim strX() as string
Call Sub B ( ... , strX , ...)
End Sub
Obviously strX can be ReDimed in Sub A, but can it be ReDimed in Sub B? VBA Help states "Used at procedure level to reallocate storage space for dynamic array variables." But it is not clear that this means "only at the "level" where the variable was initially declared". Trying to do this does not create a "compile" error, but does create an execution error (at least the way(s) I have tried doing this).