Activate Windows explorer

R

Ray

In one of the tools I've created, users can opt to either open a
document or save it to their desktop ... some files are so big that
they're only available as .zip files for download. In these cases,
I'd like to offer the user an option -- after download, they can
either stay in Excel or go to the folder containing the downloaded
file ... but how to do that?

I've pasted the current code below ... I've figured out how to open
Windows Explorer to the proper folder, but I'd like to have Explorer
become the top-most item on the DeskTop. I thought I could maybe do
it with a SendKeys command (as shown below), but that didn't work as I
thought ..

Any ideas?

Thanks in advance ... Ray

' some other code before this

Select Case MsgBox("The selected File has been downloaded
successfully ..." _
& vbCrLf & "" _
& vbCrLf & "Would you like to go that file now?" _
& vbCrLf & "YES ... to open the Portal Reports
folder" _
& vbCrLf & " NO ... to view the download later" _
, vbYesNo Or vbExclamation Or vbDefaultButton1,
"Download Complete!")

Case vbYes
Shell "explorer U:\Desktop\Portal Reports\"
Application.SendKeys ("%{tab}")
Exit Sub

Case vbNo

End Select

' ... other code (Error-handling) after this
 
R

Ray

Answered my own question ... for the archive:

The Shell command should have read:
Shell "explorer U:\Desktop\Portal Reports\" , vbNormalFocus

This sends the specified Explorer window to the front.
 

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