Hello friends,
I am facing this problem("MEMBER NOT FOUND" error HRESULT : 0x80020003
(DISP_E_MEMBERNOTFOUND) ) in Visual Basic 2005 (i.e. VB .NET) for the fifth statement(ObjWb = AppXls.Workbooks.Add) in the following code. I searched ,but couldn't get relevent solution. I wil give u the entire form class
'Option Strict On
Imports Excel
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btn_write_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_write.Click
Dim AppXls As Excel.Application
Dim ObjWb As Excel.Workbook
AppXls = CreateObject("Excel.Application")
AppXls.Visible = True
ObjWb = AppXls.Workbooks.Add()
ObjWb.Worksheets().Item("Sheet1").Range("A1").value = "1"
ObjWb.SaveAs("C:\pp\test.xls")
ObjWb.Close()
ObjWb = Nothing
AppXls.Quit()
AppXls = Nothing
End Sub
End Class
If I comment "Option Strict On", it gives "Member not found". (Points to line - ObjWb = AppXls.Workbooks.Add())
if "Option Strict On" is put into declares, it gives "Option Strict On disallows late binding",
"Option Strict On disallows implicit conversions from 'Object' to 'Excel.Application'"
Added ref are - Microsoft Excel 11.0 Object Library,Microsoft Excel 5.0 Object Library,
Microsoft Office 10.0 Object Library, Microsoft Office 12.0 Object Library.
If it supports Add(), Item(), Range(), Value members - it automatically pops up,. But in my case, it doesn't.
It gives only Equals(), GetHashCode(), GetType(), ReferenceEquals(), ToString() methods.
Not understanding whats going wrong? Any help would be appriciable.
Thanks :-)