Microsoft KB Archive/65824

How to Use the DDEPoke Statement in Word for Windows

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

1.00 1.10 WINDOWS

Summary: The DDEPoke function sends data to the item specified by Item$ in the application connected to channel ChanNum. ChanNum must have been opened by the DDEInitiate function.

More Information: The syntax of DDEPoke is DDEPoke ChanNum, Item$, Data$ where ChanNum is the variable for the DDE channel number that is created with the DDEInitiate statement. Item$ is a string variable containing the server applications location of the data, such as “R1C1” for Excel or a defined field such as “NAME” in Superbase 4 Windows. Data$ is a string variable containing the data that will be sent to Item$ in the application. The following are examples of how to use the DDEPoke statement in Word for Windows and place a string variable in a Superbase 4 Windows, or Excel file:

Superbase 4 Windows
In the following routine the text between <> should appear as one line without <> symbols:  Sub MAIN REM Loads Superbase minimized if not already loaded If isapploaded("SB4W") = 0 Then Shell("SB4W", 0) FirstName$ = “Test Name” REM Initiates DDE link ChanNum1 = DDEInitiate(“SB4W”, “TEST.SBF”) REM Inserts “Test Name” into the NAME field in Superbase DDEPoke ChanNum1, “NAME”, FirstName$ REM Terminates all DDE links DDETerminateAll End Sub

Excel
The text between <> should appear as one line without <>:  Sub MAIN REM Loads Excel minimized if not already loaded  If isapploaded("EXCEL") = 0 Then Shell("EXCEL", 0)  FirstName$  = “Test Name” REM Initiates DDE link ChanNum1 = DDEInitiate(“EXCEL”, “TEST.XLS”) REM Inserts “Test Name” into R1C1 in Excel DDEPoke ChanNum1, “R1C1”, FirstName$ REM Terminates all DDE links DDETerminateAll End Sub For more information on DDE and Word for Windows, see pages 31-32 of TECHREF.DOC or pages 21-24 of the “Microsoft Word for Windows Technical Reference.”

Reference(s): “Microsoft Word for Windows and OS/2 Technical Reference.” Page 148. Microsoft Press, 1990.

Additional reference words: w4wmacro