Hi,
Indeed - RTD is exactly the right way to do this.
The Excel RTD FAQ here:
http://msdn.microsoft.com/en-us/library/aa140060(v=office.10).aspx
is a great introduction, and the Kenny Kerr articles are also very
useful for this - here's one
http://weblogs.asp.net/kennykerr/archive/2008/11/13/Rtd3.aspx.
You can make an RTD server without Excel-DNA, and it will work
perfectly well. Integrating your RTD server as part of your Excel-DNA
add-in has three advantages:
- You can deploy your RTD server without COM registration in the
registry, which normally needs some installation step and admin
rights.
- Your RTD server function can easily be wrapper in friendly functions
exposed to the user, instead of the raw =RTD("servername"...)
functions.
- Your RTD server will be loaded into the same AppDomain as the rest
of your add-in, so can shared static variables that might cache some
information, hold login state etc.
THe Excel-DNA distribution has some small samples under Distribution
\Samples\RTD, and you'll find a lot of posts on the group too.
Recent check-ins of Excel-DNA have added two higher-level wrappers
that make the correct implementation of an RTD server and push-based
data sources much easier. (You can get the most recent check-in here:
http://exceldna.codeplex.com/SourceControl/list/changesets).
- An ExcelRtdServer base class which provides a somewhat friendlier
interface to implementing an RTD server, and most importantly also
wraps thread-safe update notification.
- Something I'm called 'Reactive Extensions for Excel -
RxExcel).Support for using the Reactive Extensions observables as the
source of your push data. This requires that you use .NET 4, but will
hopefully become the preferred way of implementing push data for
Excel. Some first snippets that will get you started if you already
know a bit about Rx can be found here:
http://exceldna.codeplex.com/wikipage?title=Reactive%20Extensions%20for%20Excel
, and a comprehensive introduction to Rx is here:
http://www.introtorx.com.
Both of these are still a bit experimental, so it has not been well
tested and the API will still change a little bit. But if you want to
give it a try then now is a very good time.
Regards,
Govert
On Jun 29, 7:53 am, Connor Strategies <
connorstrateg...@gmail.com>
wrote:
> I've been using ExcelDNA for normal UD functions for a while now and it's
> been great.
>
> I do, however, have a new need that has arisen. My usual use for excelDNS
> is returning a value after calculating it -- one time. Now I need for my
> DLL to subscribe to outside data and continuously update a cell based on
> new data.
>
> I know how to get the data fine -- my issue is updating the cell.
> Obviously, using the standard practice in exceldna DLL, ie, a c# function
> that returns a value won't work, right? Because I cant return a value
> multiple times from a c# function, i assume.
>
> I've read tonight of RTD servers. Do you think I'll need to create on of
> these?
>
> My project basically revolves around stock price updates. I get my stock
> data through an API for a subscription service I use. I just would love to
> know the best way these days to update a cell in real time.
>
> I know one can use VS to make an excel addin, and I know I can update a
> cell whenever I want via this method, but I'd like to let users use the old
> function style method of using my functions, ie, *myFunction(input1, input2)
> * in the cell and it returns the value.
>
> Any ideas? Thanks a bunch.