Applies To
Application Object.
Description
Closes a channel to another application.
Syntax
object.DDETerminate(channel)
object
Optional. The Application object.
channel
Required. The channel number returned by the DDEInitiate method.
Example
This example opens a channel to Word 6.0 for Windows, opens the Word document FORMLETR.DOC, and then sends the FilePrint command to WordBasic.
channelNumber = Application.DDEInitiate( _ app:="WinWord", _ topic:="C:\WINWORD\FORMLETR.DOC") Application.DDEExecute channelNumber, "[FILEPRINT]" Application.DDETerminate channelNumber
This example opens a channel to Word 6.0 for the Macintosh, opens the Word document Form Letter, and then sends the FilePrint command to WordBasic. 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 "HD:Form Letter", 6 Do channelNumber = Application.DDEInitiate( _ app:="MSWord", _ topic:="HD:Form Letter") Loop Until TypeName(channelNumber) <> "Error" Application.DDEExecute channelNumber, "[FILEPRINT]" Application.DDETerminate channelNumber