
Originally Posted by
Leith Ross
Hello jo15765,
Try this revision to your code...
Dim OpenFold As Variant
Dim oShell As Object
Dim Wnd As Object
OpenFold = UserForm1.txtBox1.Text
strFolder = "L:\" & OpenFold
Set oShell = CreateObject("Shell.Application")
For Each Wnd In oShell.Windows
If Wnd.Document.Folder.Self.Path = OpenFold Then
Exit Sub ' Folder is open - exit this Sub
Else
FollowHyperlink Address:=strFolder, NewWindow:=True
End If
Next Wnd
Hi I am not sure if you can help but I have used the code above , but instead of having a message box pop up saying the folder is open I would like to bring the open folder to the front
Dim OpenFold As Variant
Dim retval
Dim oShell As Object
Dim Wnd As Object
Set oShell = CreateObject("Shell.Application")
OpenFold = "F:\media\television\"
strFolder = "F:\media\television\"
Set oShell = CreateObject("Shell.Application")
For Each Wnd In oShell.Windows
If Wnd.Document.Folder.Self.Path = OpenFold Then
MsgBox "Folder is open"
Exit Sub ' Folder is open - exit this Sub
Else
End If
Next Wnd
retval = Shell("C:\WINDOWS\explorer.exe """ & OpenFold, 1)
Bookmarks