Word application "Visible" not working

Hi,

I did a long search but did not find a solution to a small problem:

I create a word document form a template and embed it in a richtext field. I feed it with data and then I would like to show the document for further editing.

Everything works fine, but with never versions of Office, since 2010 I think, the document is not displayed (brought to front) but the user has to click on the word document icon in the taskbar. This is annoying.

The code that worked but not anymore is as follow:

Call uidoc.GotoField( “documentFile” ) 'Embed file in a rich text field
Call uidoc.CreateObject(“Word Document”,“”,path) 'Create an OLE object
Set WordObj = uidoc.GetObject(“Word Document” ) 'Returns a handle to the OLE object

more code …

ok, that works, but then I would like to pop up the word document to show it to the user:

WordObj.activate
WordObj.Fields.Update ’ Update fields, eg. the address in a letter,…
WordObj.Application.WindowState = 1
WordObj.Application.Visible = True ’ ← this does not work anymore
WordObj.Application.Activate

Can somebody tell me what is now wrong or how I can bring the document to front.

Many thanks in advance.

fm

Subject: Works with Activateapp “Microsoft Word”

Thank you so much Jochen!

This works.

In my case I had to put: Activateapp “Microsoft Word”.

Subject: Interesting, thx for the feedback

Subject: Possible workaround

If you know the window title of the document open in Word, you could try adding the following command to your LotusScript code:
ActivateApp
In Word the window title is the file name w/o the path to the file. (At least this is true for newer versions of Word.)