troubleshooting Question

"COMexception was unhandled" when calling excel from visual basic 2005

Avatar of tiehaze
tiehaze asked on
.NET ProgrammingVisual Basic.NETMicrosoft Development
4 Comments2 Solutions5957 ViewsLast Modified:
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.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros