For i = 1 To UBound(arrData, 2)
.ColumnHeaders.Add , , arrData(1, i), 80 '添加标题,并设置宽度为100。
Next
' 如果每列宽度不同,可用数组赋值,也可以用下面方法添加标题并指定宽度:
.ColumnHeaders.Add , , arrData(1, 1), 80
.ColumnHeaders.Add , , arrData(1, 2), 120
.ColumnHeaders.Add , , arrData(1, 3), 120
.ColumnHeaders.Add , , arrData(1, 4), 30
.ColumnHeaders.Add , , arrData(1, 5), 40
.ColumnHeaders.Add , , arrData(1, 6), 40
.ColumnHeaders.Add , , arrData(1, 7), 60
.ColumnHeaders.Add , , arrData(1, 8), 60
.ColumnHeaders.Add , , arrData(1, 9), 60
.ColumnHeaders.Add , , arrData(1, 10), 40
'……………………………………………………
For i = 2 To UBound(arrData)
With .ListItems.Add
.Text = arrData(i, 1)
For j = 2 To UBound(arrData, 2)
.SubItems(j - 1) = arrData(i, j)
Next
End With
Next
End With
Worksheets("sheet1").Activate
End Sub
我要控制列宽这代码怎么办? |