Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
|
|||
|
|||
BackgroundWorker in Excel 2007 Managed Add-In
I'm trying to use a background worker to execute a query and then display the results in Excel in the workers RunWorkerCompleted event (similar to was PivotTables do when you click "Show Details" on a cell). Initially I had a problem that the RunWorkerCompleted event was not executing on the main thread. I managed to get around this by using a suggestion I found on the net, inserting the following call before calling RunWorkerAsync: AsyncOperationManager.SynchronizationContext = New WindowsFormsSynchronizationContext() Now the RunWorkerCompleted event runs on the main thread ok however if the user is performing an action e.g. typing, when the worker thread completes then any action that changes Excel in RunWorkerCompleted will raise a COM exception. It does not wait for the user to complete their action before calling the completed event. Any suggestions on how to get around this issue? Thanks Chris |
#2
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
|
|||
|
|||
BackgroundWorker in Excel 2007 Managed Add-In
Hi Chris,
I'm not the person who have the right answer but would it be possible for Your to catch the COM Exception in an error handling? --------------- With kind regards, Dennis Weekly Blog .NET & Excel: http://xldennis.wordpress.com/ My English site: http://www.excelkb.com/default.aspx My Swedish site: http://www.xldennis.com/ "Chris Herring" wrote: I'm trying to use a background worker to execute a query and then display the results in Excel in the workers RunWorkerCompleted event (similar to was PivotTables do when you click "Show Details" on a cell). Initially I had a problem that the RunWorkerCompleted event was not executing on the main thread. I managed to get around this by using a suggestion I found on the net, inserting the following call before calling RunWorkerAsync: AsyncOperationManager.SynchronizationContext = New WindowsFormsSynchronizationContext() Now the RunWorkerCompleted event runs on the main thread ok however if the user is performing an action e.g. typing, when the worker thread completes then any action that changes Excel in RunWorkerCompleted will raise a COM exception. It does not wait for the user to complete their action before calling the completed event. Any suggestions on how to get around this issue? Thanks Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can future dates on Excel be managed in Outlook calendar? | Excel Worksheet Functions | |||
Excel v10 can't find function in C# .Net managed Automation add-in | Excel Programming | |||
Imported Date & Time format with calcs. managed in excel from imrp | Excel Worksheet Functions | |||
add ins - i've managed to uninstall from excel but the thing still shows up when excel opens in msie 6?? | Setting up and Configuration of Excel | |||
.Net Managed Code - Excel | Excel Programming |