How to insert data from vb application to word document using dde poke

How to insert data from vb application to word document using dde poke

Post by Lisheng Yan » Fri, 17 Apr 1998 04:00:00



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

 
 
 

How to insert data from vb application to word document using dde poke

Post by Lisheng Yan » Fri, 17 Apr 1998 04:00:00


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

 
 
 

How to insert data from vb application to word document using dde poke

Post by Scot Kell » Sat, 18 Apr 1998 04:00:00


What about using OLE Automation?


>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 !

 
 
 

1. Write Data from VB6-DB-Application into Word-Document

Hi,

I use a Visual-Basic 6-Application on a MySQL-adress-Database "adressen".
In a datagrid, I select a column and write the selected record into
variables of type variant.
The record then contains the full adress out of 6 fields which I want to
insert into a Word-Document.
I suppose, the best method to insert the adress-record into Word should be
to use a Mailmerge-document and to write the variables each into
Mailmerge-fields, but I have no idea how to tell Word to use the Variables
of my Application for Mailmerge.
Does anyone have an idea?

Thanks,
Dirk

2. ORACLE Positions in DE

3. Automatic inserting of data in a word document ?

4. Backup Order?

5. Storing a WORD document in SQL Server using ADO and VB

6. how to solve DEADLOCK ?

7. Moving VB data into MS Word Document

8. US-MA: Oracle Web Developer

9. Filemaker record to word document and word document list

10. API-DDE-Request/Poke

11. DDE Poke Needed

12. VB and Word, DDE errors

13. Inserting a Word Document into Text field