Type TStrArray
Items() As String
End Type
Sub Test()
Dim jagged() As TStrArray
''add the first "record"
ReDim jagged(0)
''add a "field"
ReDim jagged(0).Items(0)
''populate it
jagged(0).Items(0) = "Drawing1"
''oh my, we just discovered we have a layout, we need another "field"
ReDim Preserve jagged(0).Items(1)
''ok, populate it
jagged(0).Items(1) = "Layout2"
''oh my, and yet another layout
ReDim Preserve jagged(0).Items(2)
''populate it
jagged(0).Items(2) = "Layout3"
''ok, let's add another "record"
ReDim Preserve jagged(1)
''add 4 "fields" to this record (remember that basic is
''goofy, dim (3) = elements 0,1,2,3 so 4 elements total
ReDim Preserve jagged(1).Items(3)
jagged(1).Items(0) = "Drawing2"
jagged(1).Items(1) = "Layout1"
jagged(1).Items(2) = "Layout2"
jagged(1).Items(3) = "Layout3"
''yada. Add debug.print statments to suit to illuminate the contents
''in practice one would try to know ahead of time the number
''of array elements required, for the primary and nested arrays.
''There's a significant performance hit every time you use redim
''preserve; use it only when absolutely necessary.
End Sub
页:
1
[2]