|
发表于 2004-3-10 22:03:00
|
显示全部楼层
[I]注意a要定义为全局变量或窗体的模块级变量(下面画线的语句)。 [/I]Private Type aa
name As String
firstrow As Integer
lastrow As Integer
End Type
[U]Private a() As aa[/U]
Private Sub addtype(str)
Dim k As Integer
k = UBound(a, 1)
ReDim Preserve a(k + 1)
k = UBound(a, 1)
With a(k)
.name = str
.firstrow = a(k - 1).lastrow
.lastrow = .firstrow
End With
Debug.Print k, a(k).name, a(k).firstrow, a(k).lastrow
End Sub
Private Sub Command1_Click()
ReDim a(0)
a(0).firstrow = 2
a(0).lastrow = 2
a(0).name = "ok"
Dim i As Integer
addtype "ok"
End Sub |
|