View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Shreyash Shreyash is offline
external usenet poster
 
Posts: 1
Default 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