Develop Real-Time Data servers (RTD )
for Excel 2007 - 2002 in Delphi 5 - 2007

Add-in Express™
for Microsoft® Office and CodeGear® VCL

Add-in Express VCL and Excel RTD servers

Microsoft Excel 2002 - 2007 provides a new way to view and update data in real time instead of 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 Real-Time Data servers and Excel user defined functions technologies and provides the same RAD way as for COM Add-ins and Smart Tags.

The sample below demonstrates how to build an RTD server for Microsoft Excel 2007. If you need to develop a Real-Time Data server for earlier Excel versions, have a look at a sample RTD server for Excel 2002-2003.

1. Create a new RTD server project with Add-in Express wizard

Note. Automation add-ins are supported by Excel 2002 and higher.

In the Delphi IDE, close all opened projects, select the "File|New|Other:" item on the main menu, and run  the "MS Excel Real-Time Data Server" wizard on the "Add-in Express" tab of the "New Item" dialog box:

Create an Excel RTD Server project with a wizard

In the wizard windows, you enter the name of the project, the destination folder, coclass name, and the server type (DLL or EXE). The wizard generates a new project and opens it in the Delphi IDE.

2. Name your RTD server

The RTDServer module (MyRTDServer1_IMPL.pas) is the heart of the project: it is a placeholder of the RTD Topic component; also, it provides you with RTD server properties.

RTD Server properties

3. Add a new topic

To add a new topic select the Add-in Express tab on the Component Palette and add adxRTDTopic to the RTDServer module. In the Object Inspector, specify the topic via the StringXX property and handle the OnRefreshData event: 

RTD Topic component

Technical information:

function TRTDServerModule.MyTopicRefreshData(Sender: TObject): OleVariant; 
begin  
    Result := RandomRange(-100100); 
end
Up to 28 string values identifying the topic
Default value will be used before retrieving the first data
Enabled

4. Register and run the server

Save the project, compile it, close Excel, and register the server via "Run|Register ActiveX Server". Run Excel and enter the RTD function to a cell:

RTD Server formula in Excel

See also a sample Real-Time Data project in .NET

Build add-ins, smart tags, RTD servers in Delphi - Flash video