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

6

14
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?

Error answered 24/2, 2014 at 12:41 Comment(1)
This thread has some valuable information link. I had a similar issue and adding a sleep helped.Spectre
E
8

I ended up removing:

 PowerPoint_App.Visible = MsoTriState.msoTrue;

And it worked...!!!

Error answered 25/2, 2014 at 8:33 Comment(4)
out of curiosity - did you try to swap the lines around? So you make the app visible AFTER you have opened the presentation...Empathic
@Ahmedilyas:i did not tried that. However as i already said,same code used to work previously.Error
The office app (powerpoint) may be simply showing some message (like re-activation message, or news, or whatever message may it may opt to show on start-up) and waiting for you to click on it.. "DisplayAlerts=None" does not block those. This is sometimes the reason for this error. Try simply starting PowerPoint by hand to see if there is some pop-up message on start-up.Listen
For what it's worth, I also found that I was unable to get the COM object while running my process as a scheduled task. Running it as a standard application seemed to do the trick, though.Mccomas
M
4

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.

Marnimarnia answered 28/8, 2018 at 19:56 Comment(2)
I just encountered the same problem as the OP using Perl module Win32::OLE to read Excel files. Example I was working off of had a line $Excel->{Visible} = 1;. Commenting this out fixed the issue for me.Rowlett
For Interop Excel, a similar thing worked for me! var excelApp = new Microsoft.Office.Interop.Excel.Application(); excelApp.Visible = false;Karyogamy
W
3

I just want to say that Nikolay's advice was 100% spot on for me. Although my problem was with code that interacted with Excel rather than PowerPoint, I believe it'll apply all the same.

Suddenly and seemingly out of nowhere a service that had been running flawlessly for years without issues started encountering this error. There weren't any recent code changes that could've been suspect, either.

I logged into the server via Remote Desktop using credentials for the service account that runs the automated service in question and as soon as I manually launched Excel, I was presented with a pop-up with some unrelated news I didn't care about. I clicked OK on this, closed Excel, logged out, and restarted the service and voila! No more issues.

Long story short, the root cause of the problem (for me) was that Excel was trying to present a pop-up and continued code execution couldn't continue because there wasn't a user to acknowledge the pop-up. Acknowledge it and your issue will go away if you have the same issue I did.

Winston answered 21/10, 2020 at 23:58 Comment(0)
E
1

For me, I had to wait for Excel to be "ready" after opening up a workbook. The below fixed the issue:

xlApp = new Excel.Application();
xlBook = xlApp.Workbooks.Open(workbook);

// wait for the workbook to open
while (!xlApp.Ready)
{
    Thread.Sleep(500);
}
Elison answered 25/2, 2021 at 3:7 Comment(2)
Didn't resolve it for me. I actually got the COMException when calling xlApp.Ready!Myriagram
@MikeLowery Interesting. I would check the 'Microsoft Visual Studio Tools for Office 2010 Runtime' and do a repair.Elison
S
1

For me removing this line resolved the issue: xlApp.ScreenUpdating = false; (c# excel interop)

Stultz answered 28/2 at 19:8 Comment(0)
C
0

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.

Camey answered 31/5, 2019 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.