Microsoft KB Archive/100430

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:25, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example 3 Code in Dev. Guide Doesn't Print Word Document

ID: Q100430

2.50 2.50a WINDOWS kbole kbprint kbinterop kbprg kbdocerr

The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a


The Example 3 code shown on page D13-22 in the "Developer's Guide" does not print the embedded Microsoft Word for Windows document as stated.

To print the embedded Word for Windows document, make the following changes to the code:

   SELECT oletable
   LOCATE FOR oletype = "MSWord"
   @ 0,0 SAY object VERB 0 NOWAIT     && NOWAIT clause is undocumented *
   ichan = DDEInitiate("WinWord", "System")
   =DDEExecute(ichan, "[FilePrint]")  && print the embedded document
   =DDEExecute(ichan, "[FileClose]")  && closes the document **
   =DDEExecute(ichan, "[FileExit]")   && exits Word for Windows


 * There is a NOWAIT clause on the @ ... SAY-BMPs and OLE Objects command
   that is not documented in the "Language Reference" manual or the Help
   file in FoxPro 2.5 for Windows. (It is documented in the Help file for
   FoxPro 2.5a for Windows.) The purpose of the NOWAIT clause is to prevent
   FoxPro from waiting for Word to finish printing.
    • The DDEExecute() command can execute only a single command at a time.


To test the incorrect code, create a table called OLETABLE and add two fields, the first having a field type of character and the second having a field type of general; that is, OLETYPE c(10) and OBJECT g(10). Add one record in OLETABLE, store "MSWord" in OLETYPE, and embed a WinWord document in OBJECT. Then execute the example 3 code. FoxPro seems to hang after running the code and Word for Windows does not print the embedded document stored in the general field.

Additional reference words: FoxWin 2.50 2.50a docerr winword DDE KBCategory: kbole kbprint kbinterop kbprg kbdocerr KBSubcategory: FxinteropDde

Keywords          : FxinteropDde 
Version           : 2.50 2.50a
Platform          : WINDOWS

Last Reviewed: April 30, 1996
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.