RTD()

Syntax. RTD(progID,server,topic1,[topic2],...)

Definition. This function retrieves real-time data from a program that supports COM automation.

Arguments

  • progID (required). A string specifying the class name (progID) of a registered COM automation add in.

  • server (optional). The computer on which the add-in will run. This can be a local computer or a network computer.

  • topic1, [topic2],... (the first parameter is required). Parameters that specify the requested real-time data.

Note

Strings have to be enclosed in quotation marks if they are not cell references.

Background. If this function cannot find a valid real-time data server, it returns the #N/A error.

If the server is a local computer, you can omit this argument (enter a space between the commas) or specify an empty string. If you use this function in Microsoft Visual Basic for Applications (VBA), the empty string (vbNullString) is mandatory.

Note

The user of the workbook will need access to the COM add-in components on the network computer, and the DLL file must be locally registered.

With VBA, a real-time server can be accessed only by using the Microsoft Office Developer Edition (for versions of VBA before Office XP) and Visual Basic 6, or a programming language in Microsoft Visual Studio .NET until its 2010 version.

Example. The exampleRTD.dll file is located in the Chapter10 folder with sample files. To register this file, click the Start button on the taskbar, type cmd to get the command line box, and type regsvr32.exe drive:pathfile name (the u parameter will unregister the file). This DLL file returns the real-time data for the hour, minute, and second.

You can use the server with the following formulas:

=RTD("RealTime.clsRTDS",,"hour")

=RTD("RealTime.clsRTDS",,"minute")

or

=RTD("RealTime.clsRTDS",,"second")

Tip: Add a clock to your worksheet

Use the TIME() function to add a clock to your worksheet:

=TIME(RTD("RealTime.clsRTDS",,"hour"),RTD("RealTime.clsRTDS",,"minute"),
   RTD("RealTime.clsRT DS",,"second"))

Unlike active macros, the real-time server doesn’t affect changes you make on the current worksheet.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.246.148