LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calling Excel methods from a different thread (COM add-in)

Hello all. I need to know if there is any way to this. I am using VS/
C# and COM interop to develop an Add-in for Excel.

I have a thread that tries to write on some cells of the current
spreadsheet. The problem is that when Excel is busy, these call return
an exception.


class MyClass {

Excel.Range cell;

public MyClass(Excel.Range cell) { this.cell = cell; }

// This method is called from a different thread than the original one
where the add-in starts
void AsynchronousWrite(object stuff)
{
cell.Value2 = stuff;
}
}

That throws the following exception when Excel is busy (for example
when the user is editing the content of a cell):

System.Runtime.InteropServices.COMException (0x800A03EC): Exception
from HRESULT: 0x800A03EC

Is there any straightforward way to solve this problem?

Thank you for your help.

 
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
COMException raised on opening excel file in thread Ajaz Excel Programming 0 March 5th 08 12:46 PM
Multi thread in Excel Radhakrishna k.v.n.r[_2_] Excel Worksheet Functions 3 October 29th 07 05:07 AM
Excel is multi thread program? maplemaple Excel Discussion (Misc queries) 0 January 13th 06 10:43 PM
Thread safety of Excel Hans Excel Programming 2 January 2nd 05 11:13 PM
Additional thread in VB in Excel Sverre Excel Programming 0 June 8th 04 01:13 PM


All times are GMT +1. The time now is 10:27 PM.

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

About Us

"It's about Microsoft Excel"