VSTO 2005 SE add-in implemented as an Rtdserver and UDF for Excel

G

Gikxy

Many moons ago, I implemented an Excel RTDServer as a COM dll. When I
discovered UDFs I introduced an interface consisting of my function names and
to get a handle of my excel object i ended up with a C# class with the
signature:

public class MimicTime : IRtdServer, IDTExtensibility2, ITimeFns

Where ITimeFns is my UDF interface with two methods: object ShowTime(object
fmt) and object ShowCompleteTime(object fmt)

When Excel is launched, I can simply type in =ShowTime("hh:mm:ss") in a cell
and the code behind calls my RTDServer to refresh the cell every n seconds.

So what I now have is a COM add in that sets up the Excel object instance
which in turn i use to call the WorksheetFunction.RTD("","".........) method.
I use a COM shim wizard to load the add-in and in turn I get all the
Isolation and security benefits involved. All works well and the world is
good. Host Office Application - Excel 2003

Along comes Excel 2007 and VSTO SE 2005 which will
- allow me to use the AddinLoader.dll in place of my C++ COM shim.
- allow me to ditch the loosely typed IDTExtensibility2 and make use of the
strongly typed IStartUp interface of the VSTO Excel AddIn templates
- allow me to introduce ribbons and ditch my 2003 Commandbars

I now have a ThisAddin class which allows me to hook into the StartUp and
ShutDown methods and in turn access the Excel object.

My million dollar question is this: How do I port my existing solution to
use VSTO Excel AddIn model? The solution will be for Excel 2007 only.
I attempted to make the ThisAddin class implement IRtdServer and ITimeFns.
ie public class ThisAddin : IRtdServer, ITimeFns but the RtdServer events
never fired. Neverheless, I was able to see the Automation reference in the
Excel and COM Add-in list.

Am I barking up the wrong tree in terms of VSTO 2005 SE capability? Can
anyone please give me a heads up on a solution if you have any? Code samples
or usefull links would be very helpful.

Thanks
 

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

Top