how to solve Exception:Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)) in C#?

前端 未结 12 1159
梦谈多话
梦谈多话 2020-11-30 13:43

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\'

12条回答
  •  温柔的废话
    2020-11-30 14:23

    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.

提交回复
热议问题