所以在我的vb.net應用程序中,我從數據庫中提取數據(表中約有1046行)以預加載Excel電子表格中的內容。這工作正常,直到999行,但如果它超過999行,它給了我特定的錯誤。 只是想知道是否有限制。有任何想法嗎?我使用Windows 10,管理工作室2012和Excel 2007中Excel Interop工作表HRESULT:使用VB.net的0x800A03EC
代碼:
Private Sub readEmployee(ByVal employee As data.employeeList)
Dim excelWorkSheet As Excel.Worksheet
Dim startRow As Integer = 9
Dim firstNames As String = ""
Dim lastNames As String = ""
With excelWorkSheet
startRow = 9
Dim row As data.employeeList.employeeListRow
For Each row In employee.employeeList
If row.RowState <> DataRowState.Deleted Then
firstNames = CStr(IIf(row.FirstName.Trim() = "", "", row.FirstName.Trim()))
lastNames = CStr(IIf(row.LastName.Trim() = "", "", row.LastName.Trim()))
.Range("A" + startRow.ToString("n0")).Value = lastNames
.Range("B" + startRow.ToString("n0")).Value = firstNames
startRow += 1
End If
Next
End With
End Sub
你可以發佈整個錯誤消息,也是什麼代碼行你得到的錯誤? – Siva