DDERequest$()

Syntax

DDERequest$(ChanNum, Item$)

Remarks

Uses an open dynamic-data exchange (DDE) channel to request an item of information from an application. When you start a DDE conversation using DDEInitiate(), you open a channel to a specific topic recognized by the server application. In Microsoft Excel, for example, each open document is a separate topic. When you request information from the topic in the server application, you must specify the item in that topic whose contents you are requesting. In Microsoft Excel, for example, cells are valid items and they are referred to using either the "R1C1" format or named references.

DDERequest$() returns data as a text string only; if the function is unsuccessful, it returns an empty string (""). Text in any other format cannot be transferred, nor can graphics.

Argument

Explanation

ChanNum

The channel number of the DDE conversation as returned by DDEInitiate(). If ChanNum doesn't correspond to an open channel, an error occurs.

Item$

The item within a DDE topic recognized by the server application. DDERequest$() returns the entire contents of the specified item. If the server application doesn't recognize Item$, an error occurs.


Microsoft Excel and other applications that support DDE recognize a topic named System. Three standard items in the System topic are described in the following table. Note that you can get a list of the other items in the System topic using the item SysItems.

Item in System topic

Effect

SysItems

Returns a list of all items in the System topic

Topics

Returns a list of available topics

Formats

Returns a list of all the Clipboard formats supported by Word


For an example that uses the System topic, see DDETerminate().

Example

This Windows example opens a channel to Microsoft Excel and SALES.XLS and then requests the contents of cell R4C2:


channel = DDEInitiate("Excel", "C:\EXCEL\EXAMPLES\SALES.XLS")
a$ = DDERequest$(channel, "R4C2")
MsgBox a$

Here is the same example for the Macintosh:


channel = DDEInitiate("Excel", "HD1:EXCEL:EXAMPLES:BLUE SKY SALES")
a$ = DDERequest$(channel, "R4C2")
MsgBox a$

See Also

DDEExecute, DDEInitiate(), DDEPoke, DDETerminate, DDETerminateAll