Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell to Windows Explorer then to folder

Status
Not open for further replies.

Reid

Programmer
Jan 8, 1999
3
US
I need code to launch windows Explorer and go to a specific folder.
Code: Job = Me.[Job Number]
ChDrive "G"
ChDir "\Metrology\Jobs\"
stAppName = "explorer.exe"
Call Shell(stAppName, 1)
This code works only for opening Explorer, I need it to navigate to the 'Job' folder. Adding an arguement after stAppName returns 'file not found'
 

from the commandline i ran... explorer "C:\Program Files"

and explorer came up in the correct folder. So I would think that...

call shell(stAppName & " " & pathtoview, 1)

would work.
 
You might want to try this:

Dim CmdLine as String
Dim TheDir as String

TheDir = "g:\Metrology\Jobs\"
CmdLine = "explorer.exe " & TheDir
Shell CmdLine, vbNormalFocus

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I added the space after explorer.exe and it worked. Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top