Is updating Excel cells from multiple threads a bad idea?

  • Thread starter Thread starter Hans Merkl
  • Start date Start date
H

Hans Merkl

Hi,

I am involved in the development of Excel addin written with C#. The addin
updates the spreadsheet from different threads. It works as long nobody
clicks with the mouse in the spreadsheet otherwise it crashes.

I personally am sceptical of using multiple threads with Excel and am
wondering if anybody is successfully updating a spreadsheet from sveral
threads.

Thanks

Hans
 
It perhaps not a good idea to allow both automatic *and* manual updates at
the same time, even if you're only using a single thread.
With multiple threads you might want to implement some kind of lock flag, so
each thread will wait until the previous one has completed its work. Are
the threads updating overlapping ranges?

Tim
 
Tim,

No. They are not updating overlapping regions. Actually the updating works
unless somebody starts to click around in the worksheet (no editing). Then
the update function will throw an exception.

Hans
 
Hi

I think a RTD server would be more proper for your scenario.
Microsoft Excel provides a new worksheet function, RTD, that allows you to
call a Component Object Model (COM) Automation server for the purpose of
retrieving data real-time. This article describes how to use Visual Basic
to create a RealTimeData Server for use with Excel's RTD function.

How To Create a RealTimeData Server for Excel
http://support.microsoft.com/?id=285339

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top