- 积分
- 4750
- 明经币
- 个
- 注册时间
- 2003-9-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-3-8 21:25:00
|
显示全部楼层
注意a要定义为全局变量或窗体的模块级变量。
新建窗体、添加命令按钮。将下面代码放到窗体中。
Private Type aa name As String firstrow As Integer lastrow As Integer End Type Private a() As aa
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 |
|