พอดีว่า เกิด Error ปัญหาในการ Export ข้อมูลจาก Listview มา Excel Error : Error Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
Try
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")
'System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("th-TH")Dim objExcel As New Excel.Application
Dim bkWorkBook As Integer Excel.Workbook
Dim shWorkSheet As Integer Excel.Worksheet
Dim i As IntegerDim j As Integer
objExcel = New Excel.Application
bkWorkBook = objExcel.Workbooks.Add
shWorkSheet = CType(bkWorkBook.ActiveSheet, Excel.Worksheet)
For i = 0 To Me.ListView1.Columns.Count - 1
shWorkSheet.Cells(1, i + 1) = Me.ListView1.Columns(i).Text
NextFor i = 0 To Me.ListView1.Items.Count - 1
For j = 0 To Me.ListView1.Items(i).SubItems.Count - 1
shWorkSheet.Cells(i + 2, j + 1) = Me.ListView1.Items(i).SubItems(j).Text
Next
Next
objExcel.Visible = TrueCatch ex As Exception
MsgBox(ex.Message)
End Try