question

KevinLossner-8449 avatar image
0 Votes"
KevinLossner-8449 asked KevinLossner-8449 edited

Setting the focus to a dialog invoked by a WSH script

I invoke a dialog to select some files as follows:

Set fso = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
Set WshShell = CreateObject("WScript.Shell")

objWord.ChangeFileOpenDirectory("c:\")

With objWord.FileDialog(msoFileDialogOpen)
.Title = "Select the files to process...."
.AllowMultiSelect = True
.Filters.Clear
'Show only the desired file types
.Filters.Add "All Files", "*.rtf"

(... stuff happens....)*

But the dialog is often obscured by open folder windows, such as that containing the script I launch. How can I ensure that the dialog for selecting files will appear in the foreground?


office-js-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers