DDE with Word Example in Developer's Guide Not CompleteLast reviewed: April 29, 1996Article ID: Q98689 |
The information in this article applies to:
SUMMARYFoxPro can request a document from Microsoft Word for Windows using dynamic data exchange (DDE). The example on page D12-7 of the "Developer's Guide" shows how this can be done; however, the example is not complete.
MORE INFORMATIONThe line included in the "Developer's Guide" is as follows:
sWholeDoc = DDEREQUEST(iChannel, "\doc")However, in order for this line to work correctly, the topic that is used in the DDEINITIATE() command should be the document title. The following example copies the file C:\LETTER.DOC to the variable SWholeDoc:
**DOCTOVAR.PRG DEFINE WINDOW worddoc FROM 1,1 TO 25,70 FLOAT ; GROW TITLE "Word Document" MOVE WINDOW worddoc CENTER RUN /N c:\winword\winword.exe ** Store the name of the document to a variable. ** The document name and path MUST be in all caps, because ** it will be compared to the available topics in Word, which ** are all caps. document="C:\LETTER.DOC" ** Initiate a channel to Word for Windows. mchannel = DDEINITIATE("Winword","System") =DDEEXECUTE(mchannel,'[APPMinimize]') =DDEEXECUTE(mchannel,'[FileOpen .Name = "&document"]') ** Storing a list of available topics to mtopic. mtopic=DDEREQUEST(mchannel,"topics") WAIT WINDOW mtopic ** Verifying the document is an available topic. IF document $ mtopic mchandoc = DDEINITIATE("Winword","&document") SWholeDoc = DDEREQUEST(mchandoc,"\doc") ACTIVATE WINDOW worddoc @ 2,2 EDIT SWholeDoc SIZE 10,65 SCROLL FONT "Arial",12 READ =DDETERMINATE(mchandoc) ELSE WAIT WINDOW "Document not transferred from Word to FoxPro." ENDIF =DDEEXECUTE(mchannel,'[FileExit 2]') =DDETERMINATE(mchannel) REFERENCES"Using WordBasic," by WexTech Systems and Microsoft
|
Additional reference words: FoxWin 2.50 2.50a DDE Word Request
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |