Set Focus from Access to Word

C

carl

I have a button that opens a word 97 doc which works fine. How do I change
the focus from Access 97 to this word doc.
I've tried:
On Error GoTo CreateOb
Set wordApp = GetObject(, "Word.Application") 'use existing MS Word
wordApp.Application.Visible = True 'make Word visible
wordApp.Documents.Open (strPath) 'open the file
'wordApp.Documents(strPath).ActiveWindow.Activate
'wordApp.Windows(strPath).WindowState = wdWindowStateMaximize

Exit Sub

CreateOb:
Set wordApp = CreateObject("Word.Application") 'start MS Word
Resume Next
 
C

carl

Thanks Arvin for your reply. I get a runtime 5941 (requested member of the
collection doesn't exist) on the "wordApp.Windows(strPath).WindowState =
wdWindowStateMaximize" line so I commented it out.
Even if it worked, wouldn't it just maximize the doc inside the MSword app?
I wish to have the MSWord app maximized with the focus set to it. This works
for a new instance of the MSWord app (as per my error handling: CreateObject)
but not an existing instance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top