Microsoft Excel is waiting for another application to complete an OLE action

781 views
Skip to first unread message

Jiri Pik

unread,
Sep 27, 2015, 10:29:17 PM9/27/15
to exce...@googlegroups.com

Govert:

 

My ribbon has a dialog window

 

image001.png

Jiri Pik

unread,
Sep 27, 2015, 10:36:27 PM9/27/15
to exce...@googlegroups.com

Govert:

 

My ribbon has a WPF dialog window which is running on another thread, is never closed, only hidden and before hiding it tries to read and write something to active workbook using ExcelAsyncUtil.QueueAsMacro() with direct access to the Application object.

 

Sometimes, I am getting this error: Microsoft Excel is waiting for another application to complete an OLE action.

 

 

 

How to address this?

 

1.       If I sticked to the ExcelAsyncUtil.QueueAsMacro(), would avoiding using Application object help? The C API would solve this?

2.       I saw there are some new Synchronizers for Excel threads – would this help?

Jiri Pik

unread,
Sep 27, 2015, 11:55:40 PM9/27/15
to exce...@googlegroups.com

And in the new WPF UI thread, if I replace

                            SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));

 

with

 

SynchronizationContext.SetSynchronizationContext(new ExcelSynchronizationContext());

 

What would be the consequences?

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Jiri Pik

unread,
Sep 28, 2015, 1:15:17 AM9/28/15
to exce...@googlegroups.com

Hi all:

 

I think I solved it by disabling any ole message filter!

 

        [DllImport("Ole32.dll")]

        private static extern int CoRegisterMessageFilter(

            IOleMessageFilter newFilter,

            out IOleMessageFilter oldFilter);

Govert van Drimmelen

unread,
Sep 28, 2015, 3:56:26 AM9/28/15
to <exceldna@googlegroups.com>
Hi Jiri,

Whatever you do, you should never access the COM object model from another thread.

You might also look at this project for inspiration: https://github.com/Ron-Ldn/DotNetRefEdit

-Govert



On 28 Sep 2015, at 07:18, Jiri Pik <jiri...@jiripik.com> wrote:

Hi all:

 

I think I solved it by disabling any ole message filter!

 

        [DllImport("Ole32.dll")]

        private static extern int CoRegisterMessageFilter(

            IOleMessageFilter newFilter,

            out IOleMessageFilter oldFilter);

 

From: exce...@googlegroups.com [mailto:exce...@googlegroups.com] On Behalf Of Jiri Pik
Sent: Monday, September 28, 2015 5:55 AM
To: exce...@googlegroups.com
Subject: [ExcelDna] RE: Microsoft Excel is waiting for another application to complete an OLE action

 

And in the new WPF UI thread, if I replace

                            SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));

 

with

 

SynchronizationContext.SetSynchronizationContext(new ExcelSynchronizationContext());

 

What would be the consequences?

 

From: exce...@googlegroups.com [mailto:exce...@googlegroups.com] On Behalf Of Jiri Pik
Sent: Monday, September 28, 2015 4:36 AM
To: exce...@googlegroups.com
Subject: [ExcelDna] Microsoft Excel is waiting for another application to complete an OLE action

 

Govert:

 

My ribbon has a WPF dialog window which is running on another thread, is never closed, only hidden and before hiding it tries to read and write something to active workbook using ExcelAsyncUtil.QueueAsMacro() with direct access to the Application object.

 

Sometimes, I am getting this error: Microsoft Excel is waiting for another application to complete an OLE action.

 

 

<image001.png>

 

How to address this?

 

1.       If I sticked to the ExcelAsyncUtil.QueueAsMacro(), would avoiding using Application object help? The C API would solve this?

2.       I saw there are some new Synchronizers for Excel threads – would this help?

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

image001.png
Reply all
Reply to author
Forward
0 new messages