I have written a C# code in console application to open two excels and copy and paste data from one excel to another excel. It was working fine until the destination excel’s visibility was true. But I need to hide the excel at the time of execution. So I changed the visibility to false. Like,
_destExcelApp = new Excel.ApplicationClass();
_destExcelApp.Visible = false;
Now its showing an exception like
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
How to solve this one?
fat
6,3355 gold badges44 silver badges70 bronze badges
asked Dec 11, 2013 at 8:51
4
I ran into this same error being thrown when I deployed my application onto a machine without a fully activated and licensed installation of Excel. I spent hours trying to diagnose the issue. Make sure you check your Office installations to make sure they are complete.
answered Feb 19, 2014 at 21:33
Crash5998Crash5998
3365 silver badges12 bronze badges
4
I solved this behaviour with the help of this question:
Strange behaviour of «Call was rejected by callee.» exception with Excel
The issue was simply that the Workbook.Open hadn’t finished when I gave a Worksheet.SaveAs command. So sometimes, the script would work, sometimes not.
I simply added a pause in the script after Workbook.Open and it worked. I went on to find a property Ready, which allowed me to do exactly what I wanted:
$excel = New-Object -ComObject "Excel.Application" -ea Stop
$wb = $excel.Workbooks.Open($workbook)
$sheet = $wb.Sheets("List")
while (-not $excel.Ready) {
sleep 1
}
$sheet.SaveAs($csvpath,6)
So in my case, it had nothing to do with non-activated or corrupted Excel installations.
![]()
answered Jan 10, 2019 at 10:13
![]()
JoostJoost
1,1261 gold badge10 silver badges19 bronze badges
Ensure that MS Word/Excel is not showing a dialog box that needs a response.
I set a breakpoint on the line that caused the failure, then set .Visible to true in PowerShell, to find this:
$word.Visible = $true

After I clicked ‘Yes’ and updated the settings, after I re-ran my scripted COM interactions, they succeeded.
answered Jan 9, 2018 at 0:07
![]()
CJBSCJBS
15.1k6 gold badges85 silver badges135 bronze badges
4
I was facing the same error and many solutions suggested were not working for me.
I had an application running in windows 8 and I found that the problem was Excel always asking to choose default application for «xlsx» extensions.
When executing the application no window dialog appeared, just the error was shown.
I solved the problem going to Control Panel > Programs > Default Programs and setting Microsoft Office Excel 2016 as default program for xlsx files.
![]()
Elmue
7,4722 gold badges46 silver badges57 bronze badges
answered Jun 5, 2017 at 14:55
4
I ran into this issue with Word and my solution was uninstalling OpenOffice. I’m not sure if there’s another solution but most likely has to do with the dlls and a conflict with the default file handler for the particular files you are generating programmatically.
answered May 12, 2015 at 11:10
amadibamadib
87014 silver badges33 bronze badges
1
Are you copying a range of information from one document to another, or are you going back and forth between the 2 documents copying cell by cell? Excel is single threaded, so if you go back and forth, it could cause this issue.
answered Dec 11, 2013 at 16:50
2
Ran into this problem on my machine. Excel is fully activated and already the default program for .xlsx files. I was loading a workbook template I created with pivot tables and having a script update the data in the tables. Turns out that if the pivot tables are set to «Refresh data when opening the file» under Pivot Table Options > Data, it causes some sort of threading contention issues.
Disabling the refresh on opening solved the issue.
answered Nov 13, 2018 at 18:14
In my case, I simply restarted my machine and found out that there was a windows update pending. Restarting the machine solved my problem.
answered Apr 5, 2019 at 18:51
RitziesRitzies
331 silver badge7 bronze badges
I agree with those that say excel license must be activated, I had the same problem and I activated the license everything works fine — Papiki
answered Feb 26, 2020 at 6:06
I encountered this Error today in Excel 2016.
We found out that the computer with this problem had some add-ins activated.
Strangely that one pc took ages to start excel. after deactivating the add-ins our program worked fine.
Strangely we couldn´t reproduce this on our dev pc´s.
answered Feb 6, 2018 at 12:33
Martin H.Martin H.
1333 silver badges8 bronze badges
I have the same problem. I ran the program on «Windows XP x86» and it crashed with a similar error. The problem was in the line:
sheetSource.Cells(i, iColumn).Interior.Color = RGB(255, 255, 0)
Multiple executions of this line resulted in a crash. When I deleted it immediately everything started working fine.
answered Jan 15, 2021 at 12:53
PavelPavel
111 bronze badge
I can offer another thing to look out for in addition to the solutions above, which seem to converge on this comment (on an answer by Alielson Piffer),
SUMMARY: So by the answers here we could conclude that this error may occur when Excel is showing any message in a popup window like for example "This software is not activated" or "Do you want Excel to be the default application for DOCX files?". – Elmue Jun 12 '17 at 22:43
There were no open messageboxes or prompts but there was an unended process (Word.exe in my case) in task manager that I needed to end. That fixed it.
This would explain why a restart helped another user.
answered Jun 5, 2020 at 7:13
M HM H
1852 silver badges8 bronze badges
Make sure you check your Office installations to make sure they are complete.
otherwise try following
try App visibleity false
after the all Data is writin then
turn on the Visibility
ex
Dim wapp As new excel.Application
….
.
.
wapp.Visible = false
‘do your writing
..
.
.
.
.
‘then turn on your visibility
wapp.Visible = True
answered Jun 12, 2020 at 6:59
![]()
1
- Remove From My Forums
-
Question
-
I have a VB program that creates Word documents automatically. It has worked perfectly fine through prior versions of Windows and Word. We recently switched to Windows 8.1 and Word 2013. When creating a Word document, I get the error message «-2147418111,
Call was rejected by callee»A portion of my code is below:
Imports System
Imports System.IO
Imports System.Text
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.WordPublic Class frmCreateDocs
Public wdObj As Word.Application
Public wdUnits1 As WdUnits = WdUnits.wdStory
Public wdBk As WdGoToItem = WdGoToItem.wdGoToBookmark
Public wdFmt As WdDocumentType = WdDocumentType.wdTypeDocument
Public wdChar As WdUnits = WdUnits.wdCharacter
Public wdLine1 As WdUnits = WdUnits.wdLine
Public wdPara As WdUnits = WdUnits.wdParagraph
Public wdExt As WdMovementType = WdMovementType.wdExtendWith wdObj
DocName = SetTemplate & «Lgl2010.dotx»
.Documents.Add(Template:=SetTemplate & «Lgl2010.dotx», NewTemplate:=False, DocumentType:=WdDocumentType.wdTypeDocument)
DocName = SetDir & «TrustAmend.docx»
.Documents.Open(FileName:=SetDir & «TrustAmend.docx», ReadOnly:=True)
.Selection.EndKey(wdUnits1, Extend:=wdExt)
.Selection.Copy()
.ActiveDocument.Close()
.Selection.Paste()
End WithThe error seems to occur when the .Selection.Endkey command is run.
Any suggestions?
Don Murray
Answers
-
Hello Don,
Try to use the following line of code instead:
Selection.EndKey(Unit:=wdUnits, Extend:=wdExtend)
-
Marked as answer by
Monday, February 2, 2015 5:25 PM
-
Marked as answer by
Hey Everyone hoping someone can help me I am at a dead end. Here is the scenario:
When we merge a document thru our database to send to efiling we are getting an error message stating Call was rejected by callee (RPC_E_CALL_REJECTED).
Now we only get this error message if we have any images in the document. If we take the state seal and the signature box out of the document everything works fine.
We have tried with only image different images different file types of images. Any image fails and creates this error.
What is happening is the document is being created in Word on the local machine, then once created and the save button is selected the database program uses the word 2010 export to pdf and creates the pdf which it them saves. This is where the error happens, and only happens with images in the documents.
We cannot change the way the pdf is exported as that is coded into the program we use.
Attached is the entire error we are getting. The client tool is what helps us get the efiling done and is part of the database program.
Any ideas would be welcomed
Thanks,
Phil
attach_file
Attachment
error.png
250 KB
Solution 1
I ran into this same error being thrown when I deployed my application onto a machine without a fully activated and licensed installation of Excel. I spent hours trying to diagnose the issue. Make sure you check your Office installations to make sure they are complete.
Solution 2
I solved this behaviour with the help of this question:
Strange behaviour of «Call was rejected by callee.» exception with Excel
The issue was simply that the Workbook.Open hadn’t finished when I gave a Worksheet.SaveAs command. So sometimes, the script would work, sometimes not.
I simply added a pause in the script after Workbook.Open and it worked. I went on to find a property Ready, which allowed me to do exactly what I wanted:
$excel = New-Object -ComObject "Excel.Application" -ea Stop
$wb = $excel.Workbooks.Open($workbook)
$sheet = $wb.Sheets("List")
while (-not $excel.Ready) {
sleep 1
}
$sheet.SaveAs($csvpath,6)
So in my case, it had nothing to do with non-activated or corrupted Excel installations.
Solution 3
Ensure that MS Word/Excel is not showing a dialog box that needs a response.
I set a breakpoint on the line that caused the failure, then set .Visible to true in PowerShell, to find this:
$word.Visible = $true

After I clicked ‘Yes’ and updated the settings, after I re-ran my scripted COM interactions, they succeeded.
Solution 4
I was facing the same error and many solutions suggested were not working for me.
I had an application running in windows 8 and I found that the problem was Excel always asking to choose default application for «xlsx» extensions.
When executing the application no window dialog appeared, just the error was shown.
I solved the problem going to Control Panel > Programs > Default Programs and setting Microsoft Office Excel 2016 as default program for xlsx files.
Solution 5
I ran into this issue with Word and my solution was uninstalling OpenOffice. I’m not sure if there’s another solution but most likely has to do with the dlls and a conflict with the default file handler for the particular files you are generating programmatically.
Related videos on Youtube

03 : 38
Replace Error Code With Exception

01 : 54
The data necessary to complete this operation is not yet available. (Exception HRESULT: 0x8000000A)

29 : 44
Part 40 C# Tutorial Exception Handling in C#

01 : 58
How To Fix Unhandled Exception Has Occurred In Your Application Error On Windows 10 / 8 /7 / 8.1

01 : 49
User canceled out of save dialog (Exception from HRESULT: 0x8004000C (OLE_E_PROMPTSAVECANCELLED))

11 : 01
Exception Handling | C# | Tutorial 24

03 : 30
Solved: Excel Pastespecial Error HResult 0x800A03EC after copy
CodeDocu Developer C# Asp Net Angular

02 : 07
HRESULT E_FAIL has been Returned from a Call to a Com Component | Add Reference Visual Studio Error

01 : 25
Solved — Exception from HRESULT: 0xC0014041 (Microsoft.SqlServer.DTSRuntimeWrap)

05 : 01
Comments
-
I have written a C# code in console application to open two excels and copy and paste data from one excel to another excel. It was working fine until the destination excel’s visibility was true. But I need to hide the excel at the time of execution. So I changed the visibility to false. Like,
_destExcelApp = new Excel.ApplicationClass(); _destExcelApp.Visible = false;Now its showing an exception like
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
How to solve this one?
-
did you try with:
... = new Excel.Application();?? -
Are you using
.Activateor.Selectanywhere? Which line gives you the error? -
I need ApplicationClass to run macro in destination excel. ApplicationClass and Application are same?
-
No I didn’t use any such things.. The error is coming while getting all worksheets in the excel i.e. excelSheets = _destExcelWorkbook.Worksheets;
-
-
So you’re suggesting that the exception is being raised because of unactivated and unlicensed Excel and that activating it would fix that issue. Sounds odd. Btw welcome to Stack Overflow.
-
@BleedingFingers, yes. I ran into a situation where this exception was thrown, and another function of my application threw a separate error relating to «reduced functionality mode.» Re-installation and activation of Excel resolved both issues.
-
I’ve been experiencing the same issue with an unactivated version of Excel. I think in general it’s caused by Excel being busy at the time you invoke it — that could be because it’s attempting to show a dialogue warning that you don’t have a valid license, or maybe you’re attempting to open a spreadsheet with links and the linked spreadsheet isn’t available etc. I think in general the solution is to implement IMessageFilter as mentioned above (I’ve not tried this yet). I’ve worked around it by opening spreadsheets readonly, with links disabled etc.
-
This answer is nonsense. It is absolutely no problem to work with multiple worksheets in Excel automation.
-
SUMMARY: So by the answers here we could conclude that this error may occur when Excel is showing any message in a popup window like for example «This software is not activated» or «Do you want Excel to be the default application for DOCX files?».
-
Yeah! I think that was exactly the problem, @Elmue. Though, for Excel must be XLSX files.
-
Probably you did not analyze this problem thoroughly. OpenOffice neither depends on DLLs from Microsoft Office nor vice versa. So your conclusion with a DLL conflict is surely wrong. What happend probably is that Excel asked you if you want to open XLSX files with Microsoft Excel because your default program for XLSX files was OpenOffice. See the answer from Alielson Piffer who solved this problem without unstalling OpenOffice. Whenever Excel opens a popup at startup you may get error RPC_E_CALL_REJECTED or VBA_E_IGNORE or DISP_E_EXCEPTION.
-
You are right. The question is about Excel, not Word.
-
Actually, my problem happened when I was working with a Word file. But since the problem appear to be the same for Office files, I agree it would be easier if I just say about Excel instead. Thanks for the help, @Elmue!
-
Yes, thanks, some of my DocxManager (document manager for MS Word with tags, tabs, etc) users reported the
Call was rejected by calleeerror in such situations. This should be the root of such issue, not that Word’s not the default program as described in another answer. -
This is happening to me in Windows 10. When I click Yes, it just tells me I have to do it myself in Settings. I don’t know which extensions besides doc and docx it wants. This is stupid.
-
@Arrow_Raider — it doesn’t matter what the configuration is; what matters is that the dialog doesn’t show (because it interferes with the automation). When the dialog appears, regardless of your response, make sure to select «Don’t show this message again», then it won’t block future automated launches of MSWord.
-
I was able to get around this error by opening the program (MS Project 2013 in my case) as the local system account (since that is the user of the service) and going through the default program setting dialogs and then closing it. To open it as the local system account I used technet.microsoft.com/en-us/sysinternals/bb897553 and opened a command prompt (as administrator) and then issued this command:
psexec -s -i "C:Program Files (x86)Microsoft OfficerootOffice15WINPROJ.EXE"The executable will be whatever program is the problem. -
Please clean up your suggestion; it’s really hard to follow what you’re saying.
-
Sadly this does not apply to all cases. My Excel is registered and I’m getting the said error.
-
I have had a similar issue using an Excel.Sheets collection in an asynchronous method. But the issue has not appeared always but rather nondeterministically. After changing the method into a synchronous approach, the problem has not appeared anymore.
Recents
I have written a C# code in console application to open two excels and copy and paste data from one excel to another excel. It was working fine until the destination excel’s visibility was true. But I need to hide the excel at the time of execution. So I changed the visibility to false. Like,
_destExcelApp = new Excel.ApplicationClass();
_destExcelApp.Visible = false;
Now its showing an exception like
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
How to solve this one?
fat
6,2655 gold badges44 silver badges69 bronze badges
asked Dec 11, 2013 at 8:51
4
I ran into this same error being thrown when I deployed my application onto a machine without a fully activated and licensed installation of Excel. I spent hours trying to diagnose the issue. Make sure you check your Office installations to make sure they are complete.
answered Feb 19, 2014 at 21:33
Crash5998Crash5998
3365 silver badges12 bronze badges
4
I solved this behaviour with the help of this question:
Strange behaviour of «Call was rejected by callee.» exception with Excel
The issue was simply that the Workbook.Open hadn’t finished when I gave a Worksheet.SaveAs command. So sometimes, the script would work, sometimes not.
I simply added a pause in the script after Workbook.Open and it worked. I went on to find a property Ready, which allowed me to do exactly what I wanted:
$excel = New-Object -ComObject "Excel.Application" -ea Stop
$wb = $excel.Workbooks.Open($workbook)
$sheet = $wb.Sheets("List")
while (-not $excel.Ready) {
sleep 1
}
$sheet.SaveAs($csvpath,6)
So in my case, it had nothing to do with non-activated or corrupted Excel installations.
![]()
answered Jan 10, 2019 at 10:13
![]()
JoostJoost
1,1261 gold badge10 silver badges19 bronze badges
Ensure that MS Word/Excel is not showing a dialog box that needs a response.
I set a breakpoint on the line that caused the failure, then set .Visible to true in PowerShell, to find this:
$word.Visible = $true

After I clicked ‘Yes’ and updated the settings, after I re-ran my scripted COM interactions, they succeeded.
answered Jan 9, 2018 at 0:07
![]()
CJBSCJBS
15k5 gold badges86 silver badges135 bronze badges
4
I was facing the same error and many solutions suggested were not working for me.
I had an application running in windows 8 and I found that the problem was Excel always asking to choose default application for «xlsx» extensions.
When executing the application no window dialog appeared, just the error was shown.
I solved the problem going to Control Panel > Programs > Default Programs and setting Microsoft Office Excel 2016 as default program for xlsx files.
![]()
Elmue
7,3922 gold badges46 silver badges56 bronze badges
answered Jun 5, 2017 at 14:55
4
I ran into this issue with Word and my solution was uninstalling OpenOffice. I’m not sure if there’s another solution but most likely has to do with the dlls and a conflict with the default file handler for the particular files you are generating programmatically.
answered May 12, 2015 at 11:10
amadibamadib
86014 silver badges33 bronze badges
1
Are you copying a range of information from one document to another, or are you going back and forth between the 2 documents copying cell by cell? Excel is single threaded, so if you go back and forth, it could cause this issue.
answered Dec 11, 2013 at 16:50
2
Ran into this problem on my machine. Excel is fully activated and already the default program for .xlsx files. I was loading a workbook template I created with pivot tables and having a script update the data in the tables. Turns out that if the pivot tables are set to «Refresh data when opening the file» under Pivot Table Options > Data, it causes some sort of threading contention issues.
Disabling the refresh on opening solved the issue.
answered Nov 13, 2018 at 18:14
In my case, I simply restarted my machine and found out that there was a windows update pending. Restarting the machine solved my problem.
answered Apr 5, 2019 at 18:51
RitziesRitzies
331 silver badge7 bronze badges
I agree with those that say excel license must be activated, I had the same problem and I activated the license everything works fine — Papiki
answered Feb 26, 2020 at 6:06
I encountered this Error today in Excel 2016.
We found out that the computer with this problem had some add-ins activated.
Strangely that one pc took ages to start excel. after deactivating the add-ins our program worked fine.
Strangely we couldn´t reproduce this on our dev pc´s.
answered Feb 6, 2018 at 12:33
Martin H.Martin H.
1333 silver badges8 bronze badges
I have the same problem. I ran the program on «Windows XP x86» and it crashed with a similar error. The problem was in the line:
sheetSource.Cells(i, iColumn).Interior.Color = RGB(255, 255, 0)
Multiple executions of this line resulted in a crash. When I deleted it immediately everything started working fine.
answered Jan 15, 2021 at 12:53
PavelPavel
111 bronze badge
I can offer another thing to look out for in addition to the solutions above, which seem to converge on this comment (on an answer by Alielson Piffer),
SUMMARY: So by the answers here we could conclude that this error may occur when Excel is showing any message in a popup window like for example "This software is not activated" or "Do you want Excel to be the default application for DOCX files?". – Elmue Jun 12 '17 at 22:43
There were no open messageboxes or prompts but there was an unended process (Word.exe in my case) in task manager that I needed to end. That fixed it.
This would explain why a restart helped another user.
answered Jun 5, 2020 at 7:13
M HM H
1213 silver badges7 bronze badges
Make sure you check your Office installations to make sure they are complete.
otherwise try following
try App visibleity false
after the all Data is writin then
turn on the Visibility
ex
Dim wapp As new excel.Application
….
.
.
wapp.Visible = false
‘do your writing
..
.
.
.
.
‘then turn on your visibility
wapp.Visible = True
answered Jun 12, 2020 at 6:59
![]()
1
- Remove From My Forums
-
Question
-
I have a VB program that creates Word documents automatically. It has worked perfectly fine through prior versions of Windows and Word. We recently switched to Windows 8.1 and Word 2013. When creating a Word document, I get the error message «-2147418111,
Call was rejected by callee»A portion of my code is below:
Imports System
Imports System.IO
Imports System.Text
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.WordPublic Class frmCreateDocs
Public wdObj As Word.Application
Public wdUnits1 As WdUnits = WdUnits.wdStory
Public wdBk As WdGoToItem = WdGoToItem.wdGoToBookmark
Public wdFmt As WdDocumentType = WdDocumentType.wdTypeDocument
Public wdChar As WdUnits = WdUnits.wdCharacter
Public wdLine1 As WdUnits = WdUnits.wdLine
Public wdPara As WdUnits = WdUnits.wdParagraph
Public wdExt As WdMovementType = WdMovementType.wdExtendWith wdObj
DocName = SetTemplate & «Lgl2010.dotx»
.Documents.Add(Template:=SetTemplate & «Lgl2010.dotx», NewTemplate:=False, DocumentType:=WdDocumentType.wdTypeDocument)
DocName = SetDir & «TrustAmend.docx»
.Documents.Open(FileName:=SetDir & «TrustAmend.docx», ReadOnly:=True)
.Selection.EndKey(wdUnits1, Extend:=wdExt)
.Selection.Copy()
.ActiveDocument.Close()
.Selection.Paste()
End WithThe error seems to occur when the .Selection.Endkey command is run.
Any suggestions?
Don Murray
Answers
-
Hello Don,
Try to use the following line of code instead:
Selection.EndKey(Unit:=wdUnits, Extend:=wdExtend)
-
Marked as answer by
Monday, February 2, 2015 5:25 PM
-
Marked as answer by
Hey Everyone hoping someone can help me I am at a dead end. Here is the scenario:
When we merge a document thru our database to send to efiling we are getting an error message stating Call was rejected by callee (RPC_E_CALL_REJECTED).
Now we only get this error message if we have any images in the document. If we take the state seal and the signature box out of the document everything works fine.
We have tried with only image different images different file types of images. Any image fails and creates this error.
What is happening is the document is being created in Word on the local machine, then once created and the save button is selected the database program uses the word 2010 export to pdf and creates the pdf which it them saves. This is where the error happens, and only happens with images in the documents.
We cannot change the way the pdf is exported as that is coded into the program we use.
Attached is the entire error we are getting. The client tool is what helps us get the efiling done and is part of the database program.
Any ideas would be welcomed
Thanks,
Phil
attach_file
Attachment
error.png
250 KB
Problem
When importing a RequisitePro® document a runtime error appears causing the import to fail.
Symptom
The full error message is as follows:
Runtime error: Automation error
Call was rejected by callee.
(RqWordServices.WordWrapper,656,-2147418111)
Cause
This issue is often the result of the Word normal.dot becoming corrupt.
Resolving The Problem
To resolve this issue, perform the following to recreate the normal.dot:
- Close RequisitePro, and Microsoft Word.
- Search the system for all instances of the normal.dot
- Delete all copies of normal.dot.
- Open Microsoft Word and save a new document as a test.
- Once the test document has been created, a new copy of the normal.dot will be created.
- Try to import the document again.
[{«Product»:{«code»:»SSSHCT»,»label»:»Rational RequisitePro»},»Business Unit»:{«code»:»BU053″,»label»:»Cloud & Data Platform»},»Component»:»Wizards: Import»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»2003.06.13;2003.06.14;2003.06.15;2003.06.16;7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.1;7.0.1.1;7.0.1.2″,»Edition»:»»,»Line of Business»:{«code»:»LOB45″,»label»:»Automation»}}]
- Remove From My Forums
-
Вопрос
-
User is experiencing this error: ‘OLE Error: Call was rejected by callee’ when trying to export a large report to Excel.
He is using Proclarity Web Professional 6.0.149.501. Our Proclarity databases are SQL2000.
What can be causing this error?
Все ответы
-
In past cases we’ve seen the OLE errors when exporting large datasets from ProClarity to Excel. 37,000 to 50,000 rows is usually the point that errors start appears. This is due to the fact that this portion of the program was not designed for exports larger than this. Often times we recommend to customers who want to use ProClarity to export large data sets to ignore the errors and wait until the export completes.
Also, ProClarity is an analytics tool and not designed for large reporting tasks such as this. SSRS, however, is for reporting so creating a report in SSRS and even adding a cube action for that report so it appears in ProClarity would probably be a more efficient approach to reaching a reasonable exporting system.
ProClarity 6.3.2210 builds and later have support for Excel 2007 export row and column limitations. Testing documents show that we support the export of >65k rows and >256 columns with this software. However, there may still be a performance issue due to the reporting nature of this type of query.
-Joey
-
Does the export continue even with the popup error message box on the screen? If they click OK on the message box, does the export still continue?
-
Hi Liz,
In my experience yes the export usually continues after an OLE error appears. I’ve seen exports of up to 700,000 rows taking place over 5 hrs. The main point is anything past 50,000 rows is probably best for reporting software like SSRS. For the specific error of «Call was rejected by callee» — check to make sure there isn’t an active cell in Excel at the time of export. If there is an active cell that error will appear and the export will stop. The only workaround is to make sure there isn’t an active cell at the time of export.
hth,
Sean
-
Sean,
Not sure what you mean by an active cell? I have users experiencing the same issue as above and the export does not continue or returns a blank sheet.
Thanks,
Frank
-
An active cell would be a data cell where the cursor is blinking (as when typing text). Are there any other error messages like «cannot find file *.xls» that the end users are seeing?
Microsoft ProClarity | This posting is provided «AS IS» with no warranties, and confers no rights.
Я боролся с той же проблемой, но теперь я нашел решение, которое работает для меня до сих пор.
Я создал класс ComWrapper, в который обертываю COM-объект Excel. Он автоматически оборачивает каждый вложенный объект и вызов в ComWrapper и разворачивает их, когда они используются в качестве аргументов для вызовов функций или присваиваний обернутым объектам. Оболочка работает, перехватывая «Вызов был отклонен вызываемым абонентом» -exceptions и повторяет вызов, пока не истечет время ожидания, указанное в верхней части. Если время ожидания истекло, исключение, наконец, выбрасывается за пределы объекта-оболочки.
Вызовы функций для обернутых объектов автоматически оборачиваются функцией _com_call_wrapper, в которой и происходит волшебство.
Чтобы заставить его работать, просто оберните com-объект из Dispatch с помощью ComWrapper, а затем используйте его как обычно, как в нижней части кода. Прокомментируйте, если есть проблемы.
import win32com.client
from pywintypes import com_error
import time
import logging
_DELAY = 0.05 # seconds
_TIMEOUT = 60.0 # seconds
def _com_call_wrapper(f, *args, **kwargs):
"""
COMWrapper support function.
Repeats calls when 'Call was rejected by callee.' exception occurs.
"""
# Unwrap inputs
args = [arg._wrapped_object if isinstance(arg, ComWrapper) else arg for arg in args]
kwargs = dict([(key, value._wrapped_object)
if isinstance(value, ComWrapper)
else (key, value)
for key, value in dict(kwargs).items()])
start_time = None
while True:
try:
result = f(*args, **kwargs)
except com_error as e:
if e.strerror == 'Call was rejected by callee.':
if start_time is None:
start_time = time.time()
logging.warning('Call was rejected by callee.')
elif time.time() - start_time >= _TIMEOUT:
raise
time.sleep(_DELAY)
continue
raise
break
if isinstance(result, win32com.client.CDispatch) or callable(result):
return ComWrapper(result)
return result
class ComWrapper(object):
"""
Class to wrap COM objects to repeat calls when 'Call was rejected by callee.' exception occurs.
"""
def __init__(self, wrapped_object):
assert isinstance(wrapped_object, win32com.client.CDispatch) or callable(wrapped_object)
self.__dict__['_wrapped_object'] = wrapped_object
def __getattr__(self, item):
return _com_call_wrapper(self._wrapped_object.__getattr__, item)
def __getitem__(self, item):
return _com_call_wrapper(self._wrapped_object.__getitem__, item)
def __setattr__(self, key, value):
_com_call_wrapper(self._wrapped_object.__setattr__, key, value)
def __setitem__(self, key, value):
_com_call_wrapper(self._wrapped_object.__setitem__, key, value)
def __call__(self, *args, **kwargs):
return _com_call_wrapper(self._wrapped_object.__call__, *args, **kwargs)
def __repr__(self):
return 'ComWrapper<{}>'.format(repr(self._wrapped_object))
_xl = win32com.client.dynamic.Dispatch('Excel.Application')
xl = ComWrapper(_xl)
# Do stuff with xl instead of _xl, and calls will be attempted until the timeout is
# reached if "Call was rejected by callee."-exceptions are thrown.
Я дал тот же ответ на новый вопрос здесь: qaru.site/questions/16995109/…
← →
tex
(2006-01-18 18:29)
[0]
Подскажите, пожалуйста, что может вызывать ошибку «Call was rejected by callee».
Возникает у клиента при формировании отчета в формате Excel (идут большие выборки из БД). Конкретней объяснить пока не могу, т.к. на моем компе все проходит нормально.
Заранее спасибо.
![]()
![]()
← →
umbra ©
(2006-01-18 18:47)
[1]
Перевод (примерно) — «Вызов отвергнут вызываемой программой».
![]()
![]()
← →
Rouse_ ©
(2006-01-19 09:55)
[2]
Вполне может быть то что у тебя к примеру стоит 2000 офис, а у клиента другая версия данного пакета…
![]()
![]()
