dirty-shirt

I'm using the Word.Documents.Add method to open an existing template (.dotx) file. However, when this file is opened the focus does not change to the new window. It stays in the same Window that I called the Add method from.

I've tried setting the Visible property to true, activating the document and looking at the SetFocus method all with no success.

Edit, this is the code I'm using:

dim docCollection as word.documents

docCollection = globals.thisaddin.application.documents

docCollection.add("filename", Visible:=True, NewTempate:=False)

Any ideas

Cheers,

Tim.



Re: Visual Studio Tools for Office Changing focus to new document..

Cindy Meister

Hi Tim

And have you further tried (building on your original code)

dim Doc as Word.Document

'etc.

doc = docCollection.add("filename", Visible:=True, NewTempate:=False)

doc.Activate()