VB中listview导出excel?
发布网友
发布时间:2024-10-23 19:07
我来回答
共1个回答
热心网友
时间:2024-10-23 20:57
For i = 1 To Me.ListView1.ListItems.Count - 1
xl.Range("A" & i + 1).Value = Me.ListView1.ListItems(i).Text
xl.Range("B" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(1)
xl.Range("C" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(2)
xl.Range("D" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(3)
xl.Range("E" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(4)
xl.Range("F" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(5)
xl.Range("G" & i + 1).Value = Me.ListView1.ListItems(i).SubItems(6)
xl.Range("H" & i + 1).Value = FormatStr(Me.ListView1.ListItems(i).SubItems(7))
Next i
xl.Visible = True