Applies To
Application Object.
Description
Requests information from the specified application. This method always returns an array; for more information, see the example.
Syntax
object.DDERequest(channel, item)
object
Optional. The Application object.
channel
Required. The channel number returned by the DDEInitiate method.
item
Required. The item to request.
Example
This example opens a channel to the System topic in Word 6.0 for Windows and then uses the Topics item to return a list of all open documents. The list is returned in column A on Sheet1.
channelNumber = Application.DDEInitiate( _ app:="WinWord", _ topic:="System") returnList = Application.DDERequest(channelNumber, "Topics") For i = LBound(returnList) To UBound(returnList) Worksheets("Sheet1").Cells(i, 1).Formula = returnList(i) Next i Application.DDETerminate channelNumber
This example opens a channel to the System topic in Word 6.0 for the Macintosh and then uses the Topics item to return a list of all open documents. The list is returned in column A on Sheet1. On the Macintosh, you must use the Shell function to start Word, because the DDEInitiate method does not automatically start Word as it does in Windows. Also, because the Shell function is asynchronous, the macro may call the DDEInitiate method before Word has started. This example demonstrates how you can program around this by putting the DDEInitiate method call in a loop, testing channelNumber until it is no longer an error.
Shell MacID("MSWD"), 6 Do channelNumber = Application.DDEInitiate( _ app:="MSWord", _ topic:="System") Loop Until TypeName(channelNumber) <> "Error" returnList = Application.DDERequest(channelNumber, "Topics") For i = LBound(returnList) To UBound(returnList) Worksheets("Sheet1").Cells(i, 1).Formula = returnList(i) Next i Application.DDETerminate channelNumber