Exception from HRESULT: 0x800A03EC

sai_yellow

New member
Joined
May 5, 2010
Messages
3
Programming Experience
Beginner
hi all,
i am new to vb.net programming i am trying to access excel worksheet pre defined with name Books.xlsx through vb.net i have taken a form with one command button i wrote below code in that:
Imports Microsoft.Office.Interop
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices.COMException
Dim WithEvents xlBook As Excel.Workbook
Dim instance As COMException


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

' Write This in Any command button
'Here U mention ur Excel File name
xlBook = GetObject("C:\Documents and Settings\USER\Desktop\D0605" & "\Book.xlsx")
xlBook.Application.Visible = True
xlBook.Windows(1).Visible = True
xlBook.Application.WindowState = Excel.XlWindowState.xlMaximized
Dim irow As Integer
Dim jcol As Integer
'There r 3 rows X 3 columns in excel sheet
For irow = 2 To 4
For icol = 1 To 3
MsgBox(xlBook.Worksheets(1).Cells(irow, jcol).Value)
Next
Next
End Sub
End Class
i am facing error as
Exception from HRESULT: 0x800A03EC please try to help me out.

thanks...
 
Back
Top