ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exception from HRESULT: 0x800A03EC While opening Workbook (https://www.excelbanter.com/excel-programming/382734-exception-hresult-0x800a03ec-while-opening-workbook.html)

Shreyash

Exception from HRESULT: 0x800A03EC While opening Workbook
 
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.xl s",
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
'--------------------------------------------------------

--
Shreyash Singh


All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com