Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inactive Word Object.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00680097
Message ID:
00680106
Vues:
28
You can alwasy trap the error..something else you can try is..

IF TYPE("oWord.Name") == "C"
---Your Code---
ENDIF

I don't know if Name is a valid property but you can try any other valid property the same way..

>Does anyone know how to test for an active application of WORD.
>
>I have a form that has data, and I have a control on the form that opens Word and creates a file name, saves it, and then makes Word visible. It works really slick having Word pop open when the user clicks on the button.
>
>Now my problem. I want to make sure they do not open a second copy with the same file. The real problem (feature) is that the word object I create remains an object after Word is closed externally.
>
>I have...
>
> oWord = CreateObject("Word.Application")
> oWordDoc = oWord.Documents.Add()
> *messagebox("about to saveas "+docname)
> * Put something in the document so it is not blank...
> oRange = oWordDoc.Range()
> oRange.InsertAfter("System Health Report addenda for " +;
> rtrim(syshealth.period)+" "+;
> rtrim(syshealth.system)+chr(13))
> oWord.ActiveDocument.SaveAs(docname)
> oWord.visible = .t.
>
>... Before I ever create the oWord application, oWord evaluates to "X"
>... When Word is open and active, oWord evaluates to "O", and I can query it With something like ? oWord.visible()
>... When Word closes, oWord still evaluates to an "O", but when I query it after Word closes, the evaluations generate an error.
>
>Should I trap the error, or is ther a more ellegant solution.
>p.s. I have the Granor and Martin automation book, but I can't really understand it...
- Jayesh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform