how to resolve The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

夙愿已清 提交于 2020-05-28 15:34:15

问题


PowerPoint.Application PowerPoint_App;
PowerPoint_App = new PowerPoint.ApplicationClass();
PowerPoint_App.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone;
PowerPoint.Presentation presentation;
presentation = null;
try
{
    PowerPoint_App.Visible = MsoTriState.msoTrue;
    presentation = PowerPoint_App.Presentations.Open(strPptFilePath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse);
    PowerPoint.Slide tempSlide = null;
    int totalSlides = presentation.Slides.Count;
    int slideNo = 0;

I am getting the below exception on PowerPoint_App.Presentations.Open code.

Exception Message: The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

I did not received this error previously on this block of code. Everything was working perfectly before. Can anyone help?


回答1:


I ended up removing:

 PowerPoint_App.Visible = MsoTriState.msoTrue;

And it worked...!!!




回答2:


I'm working through a similar problem (controlling Excel via PowerShell), and wanted to add that -- in a way I cannot begin to explain -- the analogue to @Milind Anantwar's suggestion caused my script to start working.

More details, in case they help:

  • In my case, everything worked fine when run locally. I started seeing the

    Application is busy

    exception only when I moved to executing via an Azure Hybrid Worker Runner.

  • With reference to the following snippet, I was seeing the exception after line 2, but removing line 2 "fixed" the problem:

    $excel = New-Object -ComObject Excel.Application    
    $excel.visible = $SHOW_EXCEL    
    $workbook = $excel.Workbooks.Open($_excel_file) 
    
  • I saw the exception when $SHOW_EXCEL was set to $false.




回答3:


Check your Task Manager; you may have an orphaned application instance from a debugging session. Kill it and try again. That has been the case for me before.



来源:https://stackoverflow.com/questions/21988095/how-to-resolve-the-message-filter-indicated-that-the-application-is-busy-excep

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!