Jiri Pik
unread,
Sep 28, 2015, 11:29:17 AM9/28/15
to
Govert:
My ribbon has a dialog window
Jiri Pik
unread,
Sep 28, 2015, 11:36:27 AM9/28/15
to
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 28, 2015, 12:55:40 PM9/28/15
to
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?
Jiri Pik
unread,
Sep 28, 2015, 2:15:17 PM9/28/15
to
Hi all:
I think I solved it by disabling any ole message filter!
[DllImport("Ole32.dll")]
privatestaticexternint CoRegisterMessageFilter(
IOleMessageFilter newFilter,
outIOleMessageFilter oldFilter);
Govert van Drimmelen
unread,
Sep 28, 2015, 4:56:26 PM9/28/15
to <>
Hi Jiri,
Whatever you do, you should never access the COM object model from another thread.
Hi all:
I think I solved it by disabling any ole message filter!
[DllImport("Ole32.dll")]
privatestaticexternint CoRegisterMessageFilter(
IOleMessageFilter newFilter,
outIOleMessageFilter oldFilter);
And in the new WPF UI thread, if I replace
SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
with
SynchronizationContext.SetSynchronizationContext(newExcelSynchronizationContext());
What would be the consequences?
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.