Microsoft Excel provides a new worksheet function, RTD, that allows you to call a Component Object Model (COM) Automation server for the purpose of retrieving data real-time. This article describes how to use Visual Basic to create a RealTimeData Server for use with Excel’s RTD function.
Syntax:= RTD(ProgID, server, topic1, [topic2], …)
The RTD function syntax has the following arguments:
- ProgID Required. The name of the ProgID of a registered COM automation add-in that has been installed on the local computer. Enclose the name in quotation marks.
- server Required. Name of the server where the add-in should be run. If there is no server, and the program is run locally, leave the argument blank. Otherwise, enter quotation marks (“”) around the server name. When using RTD within Visual Basic for Applications (VBA), double quotation marks or the VBA NullString property are required for the server, even if the server is running locally.
Topic1, topic2, … Topic1 is required, subsequent topics are optional. 1 to 253 parameters that together represent a unique piece of real-time data.
Example: Let’s look at some Excel RTD function examples and explore how to use the RTD function as a worksheet function in Microsoft Excel:
Note: N/A! error – RTD servers should be digitally signed. If an RTD server is not digitally signed, the server may not load, and a #N/A error will be displayed in the cell(s) referencing the RTD server.