Word Instance Exists

Ashley Tyler

New Member
Hi all,

Progress v9.1d
Windows XP, but must run from 98-
MS Office XP, but must run from 97-

It's been a while since I posted last and wondered if any of you could shed light on a particular problem I am having.

We have an application that allows a users to create guarantees and a standard letter in Word by using automation and mailmerge.

This is working fine unless the user clicks the button twice. This will generate another instance of Word. Not a problem I hear you ask! When the user closes one instance of Word they are prompted with an error Normal.dot is in use.

Is there any way to check to see if an instance of Word is open and if so obtain a handle to that for automation purposes or will I have to mess around with the association to Normal.dot?

Any help would be appreciated.

Thanks

Ashley Tyler
 
Fly

Simple. Good development practice would be to once Word has been instantated assign a local var then before you open Word again check this var.
DEF VAR word_open AS LOG.
TRIGGER
check if word has already been instantated,
IF word_open = TRUE THEN EXIT we do not wish to open again.
Regards
 

Ashley Tyler

New Member
mpowell_esq said:
Simple. Good development practice would be to once Word has been instantated assign a local var then before you open Word again check this var.
DEF VAR word_open AS LOG.
TRIGGER
check if word has already been instantated,
IF word_open = TRUE THEN EXIT we do not wish to open again.
Regards
The only problem being is that the user may wish to create another document, once the document is created we are releasing the COM-HANDLE to Word and therefore cannot use WITH-EVENTS to handle the close event in Word.

The same problem exists if the user is editing a letter to their mother, when Progress creates the application instance there are then two instances sharing a single Normal.dot file, and again the question is posed as to whether we wish to update Normal.dot bla bla bla.

Is there a way to check if an instance is running and then create a new handle from that running instance?
 
Top