ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin for Excel - general doubts (https://www.excelbanter.com/excel-programming/305304-addin-excel-general-doubts.html)

Dotnet Newbie

Addin for Excel - general doubts
 
I have a basic c++ com based addin running inside excel already. But what i
dont know is how much of a latitude is the addin allowed while inside excel.

IDTExtensibility2 defined a class(com) that can be created by excel.
Whenever something interesting happens, excel calls one of its methods to
tell the class something has happened. USUALLY it is here that class could
do whatever it wants. Or rather the excel object structure implies so. But
if you notice, from the addins side, it is just a class that is present in
this equation. A class cant execute instructions by itslef. So it is some
EXCEL thread that has loaded the addin class and calling the class's method
on its behalf.

Now, if i were to start a timer from my classes loading routine, that would
basically mean that i have a timer for that particular thread concerned.
That would mean that i am messing around with one of excels threads. I dont
want to do that.

i dont know if it is ok to interrupt excel thread like this or in any other
manner. can i ask Excel "please wake me up periodically so that i can do my
work & not interrupt or break you in any way either" ?

If there is no way to do the above mentioned thing, well the next option is
probably to have a thread of my own. Then the problem becomes "how can i
interrupt excel from this new thread" Well, i have an Application handle
that my IDTExtensibility2 class was given when it was loaded by excel. I
could use that to probe excel / temporarily ask excel to wait while i do
something else / or simply raise an event that can be handled by the
instance of my original addin class. (I think the last one is more clean and
probable)

I dont know if it is ok or thread safe to call into excel randomly (& rudely
like this) using the app pointer. And even if it was thread safe i wouldnt
know how to raise an event myself, intended for my com addin Or well, it is
safe to do so, i could simply modify the cells contents myself from that
thread - but i really dont think so.

i have external events and i need to respond to them and make changes to
excel. I cant use RTD or DDE because i wouldnt know in advance which cells
to change. Or is there any other technology thats there suitable for this
kind of situation ?

Please suggest.






All times are GMT +1. The time now is 07:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com