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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to open Windows Explorer with Excel.... 3

Status
Not open for further replies.

Sheffield

Programmer
Jun 1, 2001
180
0
0
US
Greetings,

I'm looking for a way to open Windows Explorer within my VBA code. Anybody have a clue as to how this can be done?

Ideally, I'd like to launch Windows Explorer and change its Address to a predefined file path.

Thanks:)
 
You can use:
Code:
 Shell "explorer.exe"

 
Here is a little more detailed possibility

Code:
Sub runExp()
'
    Dim path1 As String
    Dim fs As Object
    Set fs = CreateObject("Scripting.FileSystemObject")
    path1 = "C:\" & ActiveCell.Value
    If fs.folderexists(path1) then
      temp = Shell("EXPLORER.EXE /e,/root," & path1, vbNormalFocus)
    End If
End Sub

Paul D
[pimp] pimpin' aint easy
 
sim,ilar to Pauls BUT no scripting

Code:
Sub Tester()
    Dim PID As Double
    Dim strRootPath As String
    
    Const strExpExe = "explorer.exe"
    Const strArg = " /e,/root, "
    
    '// Change rootpath here
    strRootPath = "C:\"
    
    PID = Shell(strExpExe & strArg & strRootPath, 3)

End Sub

Ivan F Moala
xcelsmall.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top