Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Automating MSWord issue
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01572920
Message ID:
01572935
Vues:
42
>>>I notice that when i moved to version MSWord 2010, release the spawned word session is not so clean. I am doing something like the following....
>>>
>>>WordObj = CREATEOBJECT("Word.Application")
>>>#define wdDoNotSaveChanges 0
>>>WordObj.documents.open("&lcDoc.")
>>>~~~ manipulate and save doc
>>>RELEASE WordObj
>>>
>>>Sometimes i see WINWORD in the Processes tab of TaskMgr after the automation session has ended. Is there a better, more reliable way of making sure the word session is released?
>>>
>>>Also, is there a setting in MSWord that allows me to avoid the Word startup message that asks for me to decide what to do with documents due to a prior error with MSWord? That presents a problem when i initiate another Word session after an earlier attempt encountered some kind of problem.
>>>
>>>Thanks.
>>
>>
>>Before RELEASE WordObj use:
>>
>>WordObj.Quit()
>>RELEASE WordObj
>>
>>
>>Just after you create an instance of the Word put:
>>
>>WordObj = CREATEOBJECT("Word.Application")
>>WordObj.DisplayAlerts = .f.
>>....
>>
>
>Thanks much. Is the following a more complete way to end the word instance? with the .NULL. statement?
>
>WordObj.Quit(wdDoNotSaveChanges)
>RELEASE WordObj
>WordObj = .NULL.

If you want to NULL the object do it before RELEASE the variable:
WordObj.Quit(wdDoNotSaveChanges)
WordObj = NULL
RELEASE WordObj
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform