Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE Control of Word 97
Message
De
16/06/1997 13:38:50
 
 
À
13/06/1997 05:20:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00036000
Message ID:
00036535
Vues:
55
>>>>>>** these four lines work fine
>>>>>>ox=createobject('word.document')
>>>>>>ox.application.documents.open(thisfile) && thisfile=desired file surrounded by quotes
>>>>>>ox.application.visible=.t.
>>>>>>ox.application.activedocument.printpreview
>>>>>>
>>>>>>** this one doesn't, although the help states that this is the correct syntax
>>>>>>ox.application.activedocument.printout
>>>
>>>>>When I get the printing piece to work, I'll put that it also.
>>>
>>>Hello Rick
>>>
>>>concerning work printout method, I have no definitive answer.
>>>But I have spent long hours with EXCEL and ... in the end all my OLE
>>>automation commands worked as documented.
>>>
>>>In most cases Excel requires ALL PARAMETERS to be passed to the ole engine.
>>>Possibly the same applies to Winword.
>>>
>>>if "ox.application.activedocument.printout" does not work, you should
>>>investigate sending all appropriate parameters to the Winword engine which requires (under VBA) :
>>>
>>>Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
>>> wdPrintDocumentContent, Copies:=1, Pages:="",
>>> PageType:=wdPrintAllPages, _
>>> Collate:=True, Background:=True, PrintToFile:=False
>>>
>>>That should translate into something looking roughly like:
>>>
>>>ox.activedocument.PrintOut("",wdPrintAllDocument,wdPrintDocumentContent,
>>>0,"",wdPrintAllPages,.T.,.T.,.F.)
>>>
>>>where wdPrintAllDocument,wdPrintDocumentContent,wdPrintAllPages are VBA
>>>constants (should be in some VBA Winword documentation.
>>>
>>>My short test in Paris has been successfull. I have no access to VBA Winword
>>>documentation here, i do know neither exact type nor value (numeric) of
>>>those constants.
>>>
>>>Keep us informed
>>>
>>
>>By the way, I tested the same thing using OLE to control Excel 97, and the PrintOut method works without any parameters in Excel.
>
>Rick,
>
>You should have read "My short test in Paris has NOT been successfull". Sorry
>for the mistake. I still miss the exact type and value of the constant
>parameters that should be sent to WINWORD 97.
>
>A workable alternative is to resort to the old wordbasic command set. I tried
>the wordbasic.fileprint as in :
>
>public ox
>ox=createobject('word.application')
>ox.documents.open("c:\test.doc")
>ox.wordbasic.fileprint
>ox.documents("c:\test.doc").close
>ox.quit
>
>It works clean but it is far cry from total ole control. I should
>like to add mailmerge control from fox (including runtime control of
>datasource).I suppose we need the Book for that ... but where is it ?
>
>François

It turns out that your workaround is what Microsoft is suggesting to use. I found a KB article ID:Q169565, which states that there are several problems with OLE automation and Word 97. Basically, when you receive a Type Mismatch from Word, they suggest using the Word Basic commands instead. Thanks to everyone for all your help.

Rick
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform