Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE Control of Word 97
Message
De
13/06/1997 10:24:35
 
 
À
13/06/1997 05:20:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00036000
Message ID:
00036251
Vues:
61
>>>>>>** 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

Thanks. I tried that also, but without any success. The machine I am using is new, and came with Word 97 pre-loaded. I have no acces to the word basic commands with this machine. It's actually missing from the registry. Since I can get every other OLE command to work properly, I will install Word 97 on another machine and see if the PrintOut method works there.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform