Re: Using OLE-automation and Word97

From: DanHW <danhw_at_aol.com>
Date: 1 Jul 1998 02:34:31 GMT
Message-ID: <1998070102343100.WAA14707_at_ladder01.news.aol.com>


>Hi there,
>
>Has anybody used OLE-automation with Word97 yet?
>I've got a form in which I use an OLE-container
>containing an embedded Word document.
>I'd like to activate the container and save its
>contents on a file-server using Word Visual Basic commands,
>but I can't seem to get it working.
>Can anyone help ?
>
>TIA,
>
>
>
>Wessel van Alphen
>
>

YES I got it working!!! There was an article in the IOUG Select magazine that explains it. In case you don't, I can recall the general process, and some of the gotcha's. Hopefully it will be close enough so you can manage...(I'm doing this from memory...).

Look at the OLE2 package, and related help; it really is all there

declare

     application <I forget the data type...)
     arglist   <same comment...>
   

begin

    application := ole2.create_obj('word.basic');     ole2.createarg(arglist);

    ole2.add_arg (arglist, 0);
     ole2.add_arg(arglist, '');
     ole2.invoke (application, 'FileNew',arglist);

    ole2.add_arg(arglist, 'my words');

    ole2.invoke (application, 'insert', arglist);     ole2.destroyarg(arglist);
end;

The procedure names are off, but look in the package and you can hopefully decipher the right ones. This example will start up word and

.. Now, the gotchas...

the 'word.basic' starts up word97, with the WordBasic 'interpreter' running. This IS NOT
Word Visual Basic. You have a limited set of commands you can use; find a MSWord Developers Kit book to see what you can do.

I am still experimenting on what you can do through this; I am meeting with mixed successes. The arglist contents are determined by looking at the arguements required by the WordBasic command. For example, the FileNew command in WordBasic something like
FileNew .type=0 .template=""

arg#1 is 0 for new, 1 for existing;
arg#2 is the name of the template.
 That is where the calls to arglist come in - to load this list.

Hope this is enough to get you started.
Good luck

Dan Hekimian-Williams Received on Wed Jul 01 1998 - 04:34:31 CEST

Original text of this message