Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can future dates on Excel be managed in Outlook calendar? larryf Excel Worksheet Functions 0 November 15th 06 03:13 PM
Excel v10 can't find function in C# .Net managed Automation add-in Andrew Excel Programming 2 May 27th 06 07:39 AM
Imported Date & Time format with calcs. managed in excel from imrp Todd F. Excel Worksheet Functions 0 July 8th 05 09:03 PM
add ins - i've managed to uninstall from excel but the thing still shows up when excel opens in msie 6?? msnews.microsoft.com Setting up and Configuration of Excel 1 March 15th 05 09:24 PM
.Net Managed Code - Excel Francois[_3_] Excel Programming 0 August 12th 04 07:37 AM


All times are GMT +1. The time now is 09:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"