I have listview as the file attach below. It is possible to sent this information to microsoft excel?Have a sample for that play with the sample code?
Printable View
I have listview as the file attach below. It is possible to sent this information to microsoft excel?Have a sample for that play with the sample code?
You have to loop through your listview items and write the values out to the Excel sheet.
Check my FAQ for example code on automating Excel from VB 6.
TryCode:Private Sub Command1_Click()
Dim objExcel As New Excel.Application
Dim bkWorkBook As Workbook
Dim shWorkSheet As Worksheet
Dim i As Integer
Dim j As Integer
Set objExcel = New Excel.Application
Set bkWorkBook = objExcel.Workbooks.Add
Set shWorkSheet = bkWorkBook.ActiveSheet
For i = 1 To ListView1.ColumnHeaders.Count
shWorkSheet.Cells(1, Chr(64 + i)) = ListView1.ColumnHeaders(i)
Next
For i = 1 To ListView1.ListItems.Count
shWorkSheet.Cells(i + 2, "A") = ListView1.ListItems(i).Text
For j = 2 To ListView1.ColumnHeaders.Count
shWorkSheet.Cells(i + 2, Chr(64 + j)) = ListView1.ListItems(i).SubItems(j - 1)
Next
Next
objExcel.Visible = True
End Sub