> I don't seem to be able to assign a variable-sized array in a sub:
>
> Dim strCode() As String
> strCode(1) = "hello"
>
> tells me "Subscript out of range". What am I doing wrong? Thanks.
The empty parens in the original Dim only set it up as a dynamic array, which *may*
be resized. You still need to explicitly resize it, as needed, when needed.
Dim strCode() As String
' ...
ReDim strCode(0 To 9) As String
strCode(1) = "hello"
' ...
ReDim Preserve(0 To 19) As String
strCode(11) = "whatever"
' ...
Like that.

Signature
.NET: It's About Trust!
http://vfred.mvps.org