Anti-Rich
Well-known member
does anyone know how to open an excel file, grab a range, convert it to a datatable and store it in a dataset?
i have imported the com component, microsoft excel 11
ive tried using code like this:
dim xlapp as excel.application
dim xlwrkbk as excel.workbook
xlApp = New Excel.Application
xlApp.Visible = False
xlWrkBk = xlApp.Workbooks.Open(path)
dim dt as datatable
dt = ctype(xlapp.workbooks.worksheets(0).range("A1:B7"), datatable)
can anyone help me? this is for an important app at work and needs to be done asap
i get a com exception, but i dont know how to use the com error codes, or throw a specific com exception (i tried looking for one but couldnt find it)
please help me
regards
adam
i have imported the com component, microsoft excel 11
ive tried using code like this:
dim xlapp as excel.application
dim xlwrkbk as excel.workbook
xlApp = New Excel.Application
xlApp.Visible = False
xlWrkBk = xlApp.Workbooks.Open(path)
dim dt as datatable
dt = ctype(xlapp.workbooks.worksheets(0).range("A1:B7"), datatable)
can anyone help me? this is for an important app at work and needs to be done asap
i get a com exception, but i dont know how to use the com error codes, or throw a specific com exception (i tried looking for one but couldnt find it)
please help me
regards
adam