none
VSTO: How to update Excel with data from server RRS feed

  • Question

  • Hello, I am using VS 2010, Excel 2010 (32 bit), Windows 7.  I have created a VSTO application for Excel that updates stock prices (from a server) several times a second.  If I leave the Excel sheet untouched, every update is handled correctly.  If I happen to interact with Excel then I 'miss' these updates (actually the updates are still coming, they just can't be written to the cells because Excel is busy).  To overcome this I am using a queue (which houses the updated stock prices) and when Excel is 'Ready', I loop through the queue and empty it, writing the data to Excel.  Is there a more efficient way of accomplishing updating a sheet than using a queue?  Thank You
    Tuesday, October 23, 2012 8:22 PM

Answers

All replies

  • Hi Hbomb624,

    Thanks for posting in the MSDN Forum.

    When the VSTO write data to cell you need let all the cell under un-edit status. Otherwise there will get some exception. If you want to track the stock prices under real-time, I wouldn't recommend you use Excel VSTO technic. VSTO fit to generate finally result report instead of real-time data monitor.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 24, 2012 7:17 AM
    Moderator
  • Tom, thnx for replying.  I am not sure what you mean by: When the VSTO write data to cell you need let all the cell under un-edit status?

    Friday, October 26, 2012 6:25 PM
  • Hi Hbomb624,

    Yes, the cell can't have focus.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, October 30, 2012 6:03 AM
    Moderator
  • By the way, there's a way to check whether or not a cell is being edited.  See http://www.add-in-express.com/creating-addins-blog/2011/03/23/excel-check-user-edit-cell/ for example code.  The blog is about Add-In Express, but some of the same techniques apply to VSTO as well.

    Michael Zlatkovsky | Program Manager, Visual Studio Office Tools Team

    Wednesday, October 31, 2012 9:10 PM
    Moderator