Hi, everyone
do you know
How to insert data from vb application to word document using dde poke
I can do that from ms access to word document but I need to do that
from a vb application. Here is the code for access. If you know
how to apply it in vb, let me know by sending me email
Thank you very much !
================================
Sub cmdDDE2Word_Click ()
'send the current contact information from Access to
'Word
Dim iChannel As Integer
'go out, attach to the System topic and open the
'file we need
iChannel = DDEInitiate("WINWORD", "SYSTEM")
'
'NOTE: if you changed the installation directory for the samples,
' you'll need to change the file name shown below.
'
DDEExecute iChannel, "[FileOpen .Name=""c:\wrox\ddedoc.doc""]"
DDETerminate iChannel
'now that the file is open in Word, create a connection to it
iChannel = DDEInitiate("WINWORD", "c:\wrox\DDEDOC.DOC")
'send the information from our form to Word. We put the information
'into bookmarks ("BM_*"), predefined in Word.
DDEPoke iChannel, "BM_Name", txtFirstName & " " & txtLastName
DDEPoke iChannel, "BM_Address", txtAddress & " "
DDEPoke iChannel, "BM_City", txtCity & " "
DDEPoke iChannel, "BM_State", txtState & " "
DDEPoke iChannel, "BM_Zip", txtZip & " "
'all set, close the connection
DDETerminate iChannel
End Sub