COM timeout Excel

Magne 126 Reputation points
2024-04-24T07:13:01.6266667+00:00

Microsoft 365 Excel version 2403.

C# application (WPF on .Net 8) using excel COM interop ("automation") which adds a menu in the Excel application and setsup a click handler (in WPF).

All works normally just fine, but when debugging and say dwelling a couple of minutes (1.5 to be more specific) at a breakpoint in the click handler code, Excel pops up a Ok/Cancel dialogbox stating "Microsoft excel is waiting for another application to complete an OLE action".

if I continue my code with this box still not Ok'ed or Cancelled (which is quite easily happening), the next call to Excel, e.g. Microsoft.Office.Interop.Excel.Application.ScreenUpdating = false; this call throws a COMException (0x800AC472).

If the dialog was closed before proceeding handler code all is fine.

This seems to happen with "all" calls to Excel while dialogbox is open (Ok, I haven't tested with all calls of course, but some).

This upsets my debugging session and I would like Excel to not behave like this, at least something which could be compiled only when debug mode.

Anyone have some hints?

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,477 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,510 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 40,651 Reputation points
    2024-04-26T09:48:56.1566667+00:00

    What you describe is ordinary behavior for a COM Server that is using a message filter to control concurrency.

    Although I don't recommend doing this you could use VBA to call the CoRegisterMessageFilter function to remove Excel's filter which is responsible for putting up the dialog.

    0 comments No comments