7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub FillData()
Dim iRow As Integer, iCol As Integer
With MSFlexGrid1
.Rows = 10 '将表格设置为10行高,包括固定行
.Cols = 4
.Row = 0 '定位到第一行
'修改3列的标题
.Col = 1: .CellFontBold = True: .Text = "编号"
.Col = 2: .CellFontBold = True: .Text = "名称"
.Col = 3: .CellFontBold = True: .Text = "地址"
For iRow = 1 To .Rows - 1 '对每行第一列赋值
.Row = iRow
.Col = 1: .Text = CStr(iRow)
Next iRow
End With
End Sub
With ListView1
'设置成报表样式
.View = lvwReport
'设置列标题
Call .ColumnHeaders.Add(, , "第1列")
Call .ColumnHeaders.Add(, , "第2列")
'添加列表项
Call .ListItems.Add(1, "A", "有").ListSubItems.Add(1, "a", "yes")
Call .ListItems.Add(2, "B", "没有")
Call .ListItems.Add(3, "C", "人")
.ListItems(1).Selected = False
'显示列表项
' Debug.Print .ListItems(1).Text
' Debug.Print .ListItems(1).SubItems(1)
.ListItems(1).ListSubItems(1).Text = "yess"
End With