> >
> > What I would do is use GETOBJECT() just to determine if there's a Word instance open, but then use CREATEOBJECT() to get your own instance. Only close Word completely if there wasn't an instance open to start with. (You might want to check if that instance is still around at the end of your process.)
> >
> >
-BP
> > www.peisch.com
>
>
> YOUSFI BENAMEUR
> Is there some word existing instance (object oWord) destroy it
> IF Vartype(oWord)="O"
> oWord=null
> ENDIF
>
> oWord is public
> and you start your createObject("Word.application")....
> Regards
I would advise against this for a couple of reasons:
1. Use of a public variable here is a bad idea. What if you have a different part of your program that also automates Word and used the same public variable? You could adversely affect that part of the program if the user was running something else in a different form or menu option.
2. If a user has an instance of Word open for something that has nothing to do with your app, closing it without their permission or knowledge would be a horrible thing to do to them.
-BP
www.peisch.com