Exception from HRESULT: 0x800A03EC While opening Workbook

G

Guest

Hi,
I want to get the Name of the Sheets in a Excel File. Nothing else.
I am getting Exception from HRESULT: 0x800A03EC when I go for
Workbooks.Open in vb.net application. I tried it in C#.net too :-(
Here is my Code, plz help out. I have tried lot many things on this and
almost searched whole Google...
'--------------------------------------------------------
Dim thisThread As System.Threading.Thread =
System.Threading.Thread.CurrentThread
Dim originalCulture As System.Globalization.CultureInfo =
thisThread.CurrentCulture
Try
thisThread.CurrentCulture = New
System.Globalization.CultureInfo("en-US")

Dim ExcelApp As Excel.Application
Dim ExcelWB As Excel.Workbook
Dim objMissing As Object = System.Reflection.Missing.Value
ExcelApp = New Excel.Application
'COM object with CLSID {00020819-0000-0000-C000-000000000046} is
either not valid or not registered.
ExcelApp.Workbooks.Open("C:\InputFiles\payments.xls",
objMissing, objMissing, objMissing, objMissing, objMissing, objMissing,
objMissing, objMissing, objMissing, objMissing, objMissing, objMissing)
'Exception from HRESULT: 0x800A03EC.
Dim ExcelWs As Excel.Worksheet =
DirectCast(ExcelWB.Sheets.Item(1), Excel.Worksheet)
MsgBox(ExcelWs.Name)
Finally
thisThread.CurrentCulture = originalCulture
End Try
'--------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top