-- 作者:lur320
-- 发布时间:2020/10/23 10:18:00
-- HRESULT:0x8002000A 异常
如下代码,上传一个excel文件时出错,但是上传其他excel文件就没问题。
Dim dlg As new OpenFileDialog dlg.Filter = "excel文件|*.xls;*.xlsx;*.xlsb" If dlg.ShowDialog = DialogResult.OK Then Dim App As New MSExcel.Application app.DisplayAlerts=False app.Visible=True Dim Wb As MSExcel.Workbook \'try Wb = App.WorkBooks.Open(dlg.FileName) Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("order list") Dim dtb As New DataTableBuilder("temporder") Dim nms() As String Dim nms5 As new List(of String)
For Each Colcap As DataCol In DataTables("ordersummary").DataCols Select Colcap.name Case "productiondate","nbcode","seriesCode","MEKmo","orderindification","TTLAmount" Continue For Case Else If Colcap.IsDate Then dtb.AddDef(Colcap.Caption, Gettype(Date)) ElseIf Colcap.IsNumeric Then dtb.AddDef(Colcap.Caption, Gettype(Double)) ElseIf Colcap.IsString Then dtb.AddDef(Colcap.Caption, Gettype(String),200) End If nms5.Add(Colcap.Caption) End Select Next MessageBox.Show(2) nms=nms5.ToArray Dim dict As new Dictionary(of String,Integer) MessageBox.Show(4) Dim Rg As MSExcel.Range = Ws.UsedRange MessageBox.Show(5) Dim ary = rg.value MessageBox.Show(6) 这个对话框不会出现,就报错了。
|