DDETerminateAll Method

Applies To

Application object, Global object.

Description

Closes all dynamic data exchange (DDE) channels opened by Word. This method doesn't close channels opened to Word by client applications. Using this method is the same as using the DDETerminate method for each open channel.

Syntax

expression.DDETerminateAll

expression Optional. An expression that returns an Application object.

Remarks

If you interrupt a macro that opens a DDE channel, you may inadvertently leave a channel open. Open channels aren't closed automatically when a macro ends, and each open channel uses system resources. For this reason, it's a good idea to use this method when you're debugging a macro that opens one or more DDE channels.

See Also

DDETerminate method.

Example

This example opens the Microsoft Excel workbook Book1.xls, inserts text into cell R2C3, saves the workbook. and then terminates all DDE channels.

chan = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=chan, Command:="[OPEN(" & Chr(34) & _
    "C:\My Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=chan
chan = DDEInitiate(App:="Excel", Topic:="Book1.xls")
DDEPoke Channel:=chan, Item:="R2C3", Data:="Hello World"
DDEExecute Channel:=chan, Command:="[Save]"
DDETerminateAll