I'm working on a project with C#/WPF, I read and write in multiple Excel files with Microsoft.Office.Interop.Excel.
I face this error randomly when I read the Excel file, sometimes when I read line 1382 sometimes 2218 etc
PS : My Office Pack is activated. I tried to use :
Thread.Sleep(100);
inside foreach but dosen't work, exception still the same.
Please any help, I'm blocked in this point and I didn't find any solution.
Thanks in advance,
Any chance you have Cisco Webex Meetings installed? After spending way too much time on this (see below), I finally identified it as my issue.
In Excel, this is listed under "Add-ins" as "Productivity Tools", "Cisco WebEx LLC", "C:\Program Files (x86)\Webex\Plugins\ptwbxms64.dll". For my broken case, the DLL has file version 3910.0.1910.3000, is dated 2019-11-15, is 1,493,240 bytes, and a SHA-256 checksum of cb49aeafa37e5313907da5c42ff470db22ecde88fa7c4afc8ed59aae7c28d70a . Cisco Webex Meetings reports as "up to date" at version 39.10.4.5.
I use the Webex functionality all the time within Outlook - but don't know why it even needs to be separately enabled within Word, Excel, etc...
(Not exactly an answer, but need a place that I can respond with some length, potentially edit as I continue to look at this, and allow others to reply with their own comments...)
I'm seeing something similar here - using a PowerShell script that uses ComObject Excel.Application, and unchanged for almost a year. Started getting the same error within the past week. Cannot consistently reproduce, but also cannot complete a complex deterministic script without it failing before completion. Same script (still) works on another machine that is otherwise running a similar configuration.
I now think I've ruled-out any Windows or Office Updates here. 2 identically-versioned systems, one works, the other doesn't. Both are Windows 10 1909 Build 18363.535, O365 1911 Build 12228.20364 CTR, fully-patched as of 2019-12-11.
An example of one of my statements that now randomly fails:
$wsUsers.Name = 'Users'
... where $wsUsers
is a newly-created Excel worksheet.
Another common point of failure, where $hc
is a Range ("header columns"):
$hc.Font.Bold = $true
$hc.Interior.ColorIndex = 15
The first line (if things don't break elsewhere first) always succeeds. However, the 2nd line is (now) a frequent failure with this error.
Assuming this has nothing to do with recent updates, there are quite a few other suggestions at how to solve Exception:Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)) in C#? .
I did attempt an "Online Repair" of O365 on my affected device, with no change. I also did a complete uninstall / re-install of O365, with no change.
Here is one minimal test case:
#Requires -Version 5.0
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$excel = New-Object -ComObject Excel.Application -Verbose:$false
try{
try{
$excel.Visible = $true
$wb = $excel.Workbooks.Add()
$i = 0
try{
for(; $i -le 1000; $i++){
Write-Host "Ready1: $($excel.Ready)"
$wsAbout = $wb.Worksheets[1]
Write-Host "Ready2: $($excel.Ready)"
$wsAbout.Name = "About $i"
}
}catch{
Write-Host "Ready3: $($excel.Ready)"
Write-Host "Failed at $i".
throw $_
}
}finally{
$wb.Close($false, [System.Reflection.Missing]::Value, [System.Reflection.Missing]::Value)
}
}finally{
$excel.Quit()
[void][System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)
}
On the first system, this always fails somewhere within the first iterations (having previously worked on the same system). On the second system, I cannot get it to fail.
The most typical failure:
Ready1: True
Ready2: True
Ready1: True
Ready3: True
Failed at 101 .
Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
At ....ps1:16 char:17
+ $wsAbout = $wb.Worksheets[1]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Consider another curious error:
Ready1: True
Ready2: True
Ready1: True
Ready2: True
Ready1: True
Ready2: True
Ready1: True
Ready3: True
Failed at 3 .
Cannot index into a null array.
At ....ps1:16 char:17
+ $wsAbout = $wb.Worksheets[1]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Someone explain to me how the worksheet can exist in the first 3 iterations, but not the 4th?
I've spent too much time digging into this already. Planning to re-install my system next...
User contributions licensed under CC BY-SA 3.0