-
Apr 16th, 2008, 12:39 AM
#1
Thread Starter
Addicted Member
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED
Hello,
I am working with Visual Studio 2005 using vb.net to create a windows application, I am getting the following error:
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
on the following line of code:
oSheet.cells(rowcount + 2 + i, j + colstart).value = repdata.Rows(i).Item(j)
In my code i am trying to create a report in excel by looping over a datatable and writing its content to the excel sheet.
Any idea? Thank you in advance.
Hiba
-
Apr 16th, 2008, 12:44 AM
#2
Re: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED
We'll need to see more code than that to see what you're doing wrong. Please post the whole function block. Please remember to use [CODE] tags around the code so it is formatted properly on here.
-
Apr 16th, 2008, 12:54 AM
#3
Thread Starter
Addicted Member
Re: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED
Hello, This is a function in a class called reports that is called to write the datatable to the excel sheet.
Code:
Public Function SetDTable(ByVal repdata As DataTable, ByVal dinput As ArrayList, ByVal rowcount As Integer, ByVal sn As Boolean, ByVal recap As Boolean) As Boolean
'write the data header from the arraylist
Dim k As Integer = 0
Dim result As Boolean
If recap = True Then
rowcount = rowcount + 1
End If 'recap
'writing the header of the report
If dinput IsNot Nothing Then
For k = 0 To dinput.Count - 1
oSheet.cells(rowcount + 1, k + 1).value = dinput(k)
oSheet.cells(rowcount + 1, k + 1).Font.Bold = True
Next
End If 'hdr
Dim i As Integer = 0
Dim j As Integer = 0
Dim colstart As Integer = 0
If repdata.Rows.Count > 0 Then
'SN
If recap = True Then
colstart = 1
Else
If sn = True Then
SNnumbering(rowcount + 2, repdata.Rows.Count, oSheet)
colstart = 2 'B
Else
colstart = 1 'A
End If
End If 'recap
'write the data by looping over the datatable
For i = 0 To repdata.Rows.Count - 1
For j = 0 To repdata.Columns.Count - 1
oSheet.cells(rowcount + 2 + i, j + colstart).value = repdata.Rows(i).Item(j)
Next
Next
'set data borders
SetBorders(rowcount + 1, 1, (repdata.Rows.Count + rowcount + 1), colstart + (repdata.Columns.Count - 1), repdata.Rows.Count, oSheet)
With oSheet
.Range(.cells((rowcount + 1), 1), .cells((repdata.Rows.Count + rowcount + 1), dinput.Count)).HorizontalAlignment = Constants.xlhAlignCenter
End With
result = True
Else
result = False
End If
Return result
End Function
Hope u can help. thnx
Hiba
-
Feb 8th, 2011, 06:00 PM
#4
New Member
Re: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJE
Did you manage to find the solution for this issue? I have exactly the same situation.
-
Apr 20th, 2011, 12:43 PM
#5
Member
Re: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJE
I too have the exact same problem ... and banging my head against the wall.
Few specifics:
My vb.net app is exporting values to excel whenever necessary (i.e. once every few minutes). Using Excel 2007 on WinXp Pro, with VS2010 in my case ... but VS2008 did same thing.
I do this once on startup ...
Code:
' start excel application
oXL = New Excel.Application
oXL.Visible = True
' Get a new workbook.
oWB = frmMain.oXL.Workbooks.Open(frmMain.ExcelFileName, True, False)
oSheet = frmMain.oWB.ActiveSheet
... then I call this whenever my program is ready to export something to excel ...
Code:
Private Sub ExportToExcel(ByVal Row As Integer, ByVal Column As Integer, ByVal text As String)
Try
oSheet.Cells(Row, Column) = text
Catch ex As Exception
ExceptionMsg("Crashed in ExportToExcel", ex)
End Try
End Sub
.... what's more confusing, is this this DOES sometimes work, sometimes not within the same few minutes. It really appears random if it's going to work or not when I call this sub.
-
Oct 20th, 2011, 07:11 AM
#6
New Member
Re: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJE
Originally Posted by hiba84
Hello,
I am working with Visual Studio 2005 using vb.net to create a windows application, I am getting the following error:
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
on the following line of code:
oSheet.cells(rowcount + 2 + i, j + colstart).value = repdata.Rows(i).Item(j)
In my code i am trying to create a report in excel by looping over a datatable and writing its content to the excel sheet.
Any idea? Thank you in advance.
Hiba
Hi,
I have encountered the same error coming from c# through interop:
xlApp = new Microsoft.Office.Interop.Excel.Application();
int count_addins = xlApp.AddIns.Count;
Did you find any solution to this?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|