I built a windows application and I keep on getting the following error:
"COMexception was unhandled"
"Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))"
I have spent hours trying to get rid of this error. Can someone please tell me what I am doing wrong with the following code:
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Open(FileName)
oSheet = oBook.Sheets("Database")
oSheet2 = oBook.Sheets("Dividend History")
Private Sub btnSearchbyCusip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchbyCusip.Click
Dim Cusip As String = txtSearchByCusip.Text
Dim j As Long = oSheet2.Columns("A:A").Find(What:=Cusip, LookAt:=xlPart).Row
This last row is where I am getting the error. If anyone could give me any help, I would be greatly appreciated.