How to program Excel Real-Time Data Servers
(RTD) and user-defined functions in C#, VB .NET, C++
Add-in Express™
for Microsoft® Office and .net
Add-in Express .NET and Excel RTD servers
Microsoft Excel 2002, 2003 and Excel 2007 provide a new way to view and update data in real time instead of Dynamic Data Exchange (DDE). This real-time data (RTD) feature is really great for working with constantly changing data such as stock quotes, currency exchange rates, inventory levels, price quotes, weather forecasts, sports scores and so on. Add-in Express supports RTD technology and provides the same RAD way as for COM Add-ins and Smart Tags. For advanced customization of the Excel GUI, Add-in Express also provides Advanced Excel Task Panes and supports Excel Automation add-ins as well as XLL addins for developing custom Excel user defined functions (UDF).
Now we are going to develop a sample RTD server for Excel 2007. In the same way you can build Real-Time Data servers for Excel 2003 and 2002 (XP). Please see the most recent documentation in the Add-in Express Developer Guide: Developing Real-Time Data servers for Excel 2002 - 2007.
1. Run the RTD Server specific wizard
To create a new Excel RTD Server project based on Add-in Express, close all opened solutions, choose “File | New | Project…”, select the “Other Projects | Extensibility Projects” item, click the "Add-in Express RTD Server" icon, and click the OK button.

This will start the wizard that asks you to select a programming language and then generates the project. When the wizard is finished, the RTD Server solution will be created and opened in IDE. This solution includes the Excel RTD Server project and the setup project (optional).
2. RTD Server module
RTD Server module is the core part of every Add-in Express RTD Server project. The file name for the module is RTDServerModule.vb (RTDServerModule.cs). You place RTD Server Topic components onto the module's designer in order to create the information interface of your RTD Server. For adding topics to you RTD Server, the module provides a special command available either in the Properties window or in the context menu of the module's designer. Also, you handle RTD Server properties and events in the module.

| Refresh interval for the RTD server | |
| Allows specifying if the RTD server should be registered for all users on the PC | |
| When Excel invokes and closes the RTD server |
3. RTD Server topics
An RTD Server topic component allows you to specify a part of the information flow provided by the RTD server. You identify the topic using its properties and handle its RefreshData event.
Private Function MyTopic_RefreshData(ByVal sender As System.Object) _
As System.Object Handles AdxrtdTopic1.RefreshData
Dim Rnd As New System.Random
Return Rnd.Next(2000)
End Function

| String01, String02, ... String28 - these properties allow uniquely identify the topic | |
| The default value for the topic | |
| When the topic is connected and disconnected | |
| When the topic is required to refresh its value |
4. Deploying the Real-Time Data server
Add-in Express add-ins are based on the Add-in Express Loader which is a feature-rich shim and bootstrap application.

With automatically generated setup project, the Add-in Express Loader provides you with the following benefits:
- Manifest-configured features: setup log, non-admin installation, updating an RTD server while it is loaded
- Ready-to-use custom actions for your setup project
- Per-user and per-computer add-in installations
See also an example of RTD server in Delphi.

