Bring focus to window

C

Capitalgman

I am a newbie and am lost.

I have the following script that does just what I need, except it
opens
behind all other open windows. How do I get the file dialog to open
in front
of the other windows?

Thanks for your help.

Const msoFileDialogOpen = 1

Set objWord = CreateObject("Word.Application")

objWord.ChangeFileOpenDirectory("c:\Docs")

objWord.FileDialog(msoFileDialogOpen).Title = "Select Your File"
objWord.FileDialog(msoFileDialogOpen).AllowMultiSelect = True

If objWord.FileDialog(msoFileDialogOpen).Show = -1 Then
objWord.Visible = True

For Each objFile in
objWord.FileDialog(msoFileDialogOpen).SelectedItems
Set objDoc = objWord.Documents.Open(objFile)
Next

End If
 
D

Doug Robbins - Word MVP

Try inserting

objWord.Activate

after the

Set objWord = CreateObject("Word.Application")

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Capitalg

Thanks - but that gives me an error on that line - Cannot activate application
Code 800A11F9
Source Microsoft Word
 

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