OLE2 and Word.Basic vs. Word.Application

From: <nwgarside_at_my-dejanews.com>
Date: Fri, 09 Apr 1999 03:48:22 GMT
Message-ID: <7ejta5$k9b$1_at_nnrp1.dejanews.com>



Hi,

Does anyone know how to start an instance of Word97 from Forms (4.5) using the OLE2 package so that if an instance of Word97 is already running, the Forms application will use this instance?

It all seemed so easy with Word95; the following line:

  Word95App := OLE2.CREATE_OBJ('Word.Basic');

...would 'hook on to' an instance of Word95 if it was already running and
create a new instance of Word95 if one wasn't already running. Word97 behaves differently in that:

  Word97App := OLE2.CREATE_OBJ('Word.Application');

...just starts up a new instance of Word97 regardless of whether a previous
instance of Word97 is already running, so running this line of code multiple times leaves you with multiple instance of Word97 on the workstation.

I've used the following code to do something similar. Line 1 starts Word97 if Word97 is not already running and creates a new document. If Word97 is already running line 1 will create a new document in that instance.

  WordDoc8 := OLE2.CREATE_OBJ('Word.Document.8');   Word97App := OLE2.GET_OBJ_PROPERTY(WordDoc8, 'Application');

This works, but I really don't want to create a new document every time I run this code - my Forms application will use Word97 to open existing documents more often than it creates new documents.

Does anyone know how to get Word97 to behave in the same way as Word95?

Thanks for your time...

Neil W. Garside (Brisbane, Australia)

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Apr 09 1999 - 05:48:22 CEST

Original text of this message