Hi,
What is the code in your button?
Hi,
What is the code in your button?
![]()
Dim OpenFold OpenFold = UserForm1.txtBox1.Text strFolder = "L:\" & OpenFold FollowHyperlink Address:=strFolder, NewWindow:=True
Last edited by jo15765; 04-20-2012 at 11:00 AM.
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
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
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)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks