Re: Windows Explorer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Joel,

A literal interpretation of the OP's question suggests your modification of my proposal as the solution the OP was after. However, my hunch is that the best solution for what the OP really wanted to accomplish is your earlier post. I offered my solution with Shell launching explorer.exe, just in case the OP wanted the user to be able to navigate to the correct folder and file within that folder.

In addition to presenting the user with the ability to navigate the file system, explorer.exe will read file association information from the registry and employ the appropriate executable file to launch the selected file. However, the same could be accomplished creating an instance of the "WScript.Shell" object and using its 'Run' method. The negative to using explorer.exe is that you then oblige the user to shut down the process, or you kill the process using code, or the worst option where you leave a rogue process running to burden the system until the next reboot. I think the primary reason for wanting to launch an application using explorer is to offer the user the interface.

As I pointed out in my earlier post, if the ability to navigate to the file is what the OP wanted to offer the end user, I think a better choice than explorer.exe would be something like:
Set fd = Application.FileDialog(msoFileDialogFilePicker)


Steve Yandl



"Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2490C423-D8AF-48F5-8ADD-BD29EE414308@xxxxxxxxxxxxxxxx
Steve: I think you gave a great answer but only half the real answer.

Try this instead

retValue = Shell("C:\Windows\explorer.exe c:\temp\test.pdf", vbNormalFocus)

I included the file name to open in the command line and it opens the
application in the explorer window.





I can do it manually and it will open the file, but not sure how to do it
from VBA. If yo udon't know let me know so I can do some futher reasearch.
either send

I think we want to put the file name

"Steve Yandl" wrote:

The two lines,
Dim retValue
retValue = Shell("C:\Windows\explorer.exe", vbNormalFocus)

will open an instance of Windows Explorer and allow you to navigate the file
system and open or run files as usual but you won't be able to return
information from or control any files that you launch from the Explorer
window (the user can work with them but your VBA routine can't).

Both Office VBA and the Shell.Application make available 'Explorer like'
windows that can be used much like Explorer so your user can select a folder
or file. In these cases, you can return the path and file name and then use
the Shell function or some other means to launch or execute the file in a
way that gives you a bit more control.

Steve Yandl



"Philosophaie" <Philosophaie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:503131E8-9986-470B-8A25-7EA6671DFF22@xxxxxxxxxxxxxxxx
> Tell me if this is possible. From Excel Windows API can you open > Windows
> Explorer, open a select folder, select a file and execute it.



.



Relevant Pages

  • Re: Why are files/folders in pop-up menus now chronological?
    ... In the absence of indicators to the contrary, I currently assume Office 2007 running in Vista (gradually shifting the latter to Windows 7, but it will be a while). ... problem in Explorer, which is working fine. ... > folder ordered by the last date they were touched. ...
    (microsoft.public.office.misc)
  • Re: windows explorer stalls on file open by association
    ... If, while the system is stalled, I open another instance of windows ... explorer it triggers the open to occur immediately (on .txt files, ... second opens word and the third opens the document in word. ... Reboot and logon as administrative user. ...
    (microsoft.public.windowsxp.general)
  • Re: TrayNotify
    ... adding them to Shell. ... 2004 Windows MVP "Winny" Award ... > the .vbs script you have which restarts explorer. ... >>> kill it to then restart it, it mearly opens up windows explorer. ...
    (microsoft.public.windowsxp.general)
  • Re: Open document dialog hangs
    ... Did you happen to notice if you were having trouble with IE & win explorer? ... Right-click on the My Computer icon on the Windows ... shortly afterwards I take the option to send an error report to Microsoft. ... application starts up and opens the file with no problem as far as I can see, ...
    (microsoft.public.office.misc)
  • Re: Vertical Ruler problem
    ... clear "Windows in Taskbar" to keep multiple ... >I cannot adjust the vertical ruler at all. ... >a document I created before the problem, it opens in ... >another launch of Word and looks and works correctly. ...
    (microsoft.public.word.pagelayout)