I am writing (and teaching myself how to write) an experimental assembly in VB.NET 3.5 that is exposed via COM and then called from some Excel VBA code to initiate an instance of a class that traps some Excel events and then perform some functions on the active workbook in Excel.
To initiate the class, a reference to the Excel Application is passed from the VBA (I am using a PIA for Excel in the assembly).
I needed to perform a time-consuming operation on the active workbook from my assembly so I decided to use a BackgroundWorker
in a WinForm so that I can display a progress dialog for the operation whilst the operation completes in the background.
I would like to know if there are any problems with interacting with Excel via COM using a background worker in this way? Reason for asking is that the main class in the assembly holds the reference to the Excel application object, and this is then passed to the BackgroundWorker
so that it can determine the active workbook and then perform some operations on it. I am only accessing the workbook itself (not other objects) through one procedure.
For some reason I have it in my head that Excel might not like this - am I right?