How to use RTD Function in Excel

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:

Syntax:  

1 =RTD(“MyCOMAddin”,,”price”,”MSFT.O”)
2 =RTD(“BLOOMBERG.RTD”,””,”AAC EQUITY”,”SECURITY”_TYP”)
3 =RTD(“BLOOMBERG.RTD”,””,”XS0115748401 COMP”,”QUOTE_ASK”)
4 =RTD(“K4RtdServer”,,”plant1″,”quote”,”bid”,”MSFT.O”)
5 =RTD(“ExcelRTD.RTDFunctions”,,”Log”,”True”,”C:\Temp\TestLog.txt”)
6 =RTD(“SIXP.RTD”,,”/rt/stock/quote?Mkt=””SSE””,”SEE.ERIC-B”,”TrVo”,”UPDATES=ALL”)

Result:

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.

Add a Comment

Your email address will not be published. Required fields are marked *