Microsoft Word Basic supports DDE. The following example contains sample Word Basic code to access the WSQL DDE Server DDE server. The two different ways of retrieving the data are demonstrated: using the clipboard and receiving the data directly.
Sub MAIN
' Initialize a DDE channel to the database
chan = DDEInitiate("WSQLDDE", "dba,sql,sademo")
' Connect to the database
DDEPoke chan, "connect", ""
' Get the data using the clipboard
DDEPoke chan, "clip_data", \
"select emp_lname \
from employee where emp_id = 102"
EditPaste
' Insert the data directly into the document
DDEPoke chan, "clear", \
"select emp_lname \
from employee where emp_id = 105"
Insert DDERequest$(chan, "data")
' Disconnect from the database
DDEPoke chan, "disconnect", ""
' Terminate the DDE connection
DDETerminate(chan)
End Sub