Microsoft KB Archive/65825

How to Use the DDEExecute Statement in Word for Windows

PSS ID Number: Q65825 Article last modified on 02-17-1993

1.00 1.10 1.10a 2.00 WINDOWS

Summary: The DDEExcute sends an execute message to a receiving application. A channel to a receiving application must first be established with the DDEIntiate function.

More Information: The syntax for the DDEExecute statement is DDEExecute ChanNum, ExecuteString$ where ChanNum is the variable for the DDE channel number that is created with the DDEInitiate statement. ExecuteString$ is a string variable containing the server applications command, such as “[COPY]” for Excel or “SELECT NEXT:VIEW” for Superbase 4 Windows. The DDEExecute command uses the server’s command language. Examples are Excel’s macro language or Superbase’s DML language. The following are examples of how to use the DDEExecute statement in Microsoft Word for Windows to Excel for Windows and Superbase 4 Windows:

Superbase 4 Windows
In the following routine, the text between the angle brackets (<>) should appear as one line without the <> symbols:  Sub MAIN Q$ = Chr$(34) 'A quote REM Loads Superbase minimized if not already loaded If isapploaded("SB4W") = 0 Then Shell("SB4W", 0) REM Initiates DDE link ChanNum1 = DDEInitiate("SB4W", "") REM Opens "TEST.SBF" in Superbase DDEExecute ChanNum1, "OPEN FILE" + Q$  + “TEST.SBF” + Q$ REM Terminates all DDE links DDETerminateAll End Sub

Excel
In the following routine the text between angle brackets (<>) should appear as one line without the <> symbols:  Sub MAIN Q$ = Chr$(34) 'A quote REM Loads Excel minimized if not already loaded If isapploaded("Excel") = 0 Then Shell("Excel", 0) REM Initiates DDE link ChanNum1 = DDEInitiate("Excel", "") REM Opens "TEST.XLS" in Excel DDEExecute ChanNum1, "[OPEN(" + Q$  + “TEST.XLS” + Q$+“)]” REM Terminates all DDE links DDETerminateAll End Sub For more information on dynamic data exchange and Word for Windows, see pages 31-32 of the file TECHREF.DOC or pages 21-24 of the “Microsoft Word for Windows Technical Reference.”

Additional reference words: 1.0 1.1 1.1a 1.00 1.10 1.10a w4wmacro 2.0 2.00