Article ID: 141772
Article Last Modified on 6/11/2007
Sub Using_DDE1()
' Dimension the variables.
Dim Chan As Integer
Dim RequestItems As Variant
' Start a channel to Word using the System topic.
Chan = DDEInitiate("WinWord", "System")
' Requesting information from Word using the Formats item
' this will return a one dimensional array.
RequestItems = DDERequest(Chan, "Formats")
' Uses a FOR loop to cycle through the array and display in a message
' box.
For i = LBound(RequestItems) To UBound(RequestItems)
MsgBox RequestItems(i)
Next i
' Terminate the DDE channel.
DDETerminate Chan
End Sub
Sub Using_DDE2()
' Dimension the variables.
Dim PokeRange As Object
Dim Chan As Integer
' Create an range object to poke.
Set PokeRange = Range("Sheet1!a1")
' Initiate a channel to Word using a file as the topic.
Chan = DDEInitiate("WinWord", "c:\ddetest.doc")
' Execute a few WordBasic commands.
DDEExecute Chan, "[FileNewDefault]"
DDEExecute Chan, "[InsertPara]"
DDEExecute Chan, "[InsertPara]"
' Pokes the data in A1 into ddetest.doc.
' This is not poked into the active document.
' The data is placed in the topic that started the DDE conversation.
' \StartOfDoc is a predefined bookmark in Word.
DDEPoke Chan, "\StartOfDoc", PokeRange
' Terminate the DDE channel.
DDETerminate Chan
End Sub
programming with dde
Additional query words: 5.00c 8.00 XL97 communicate talk send XL
Keywords: kbdtacode kbhowto kbprogramming KB141772