David Sinclair
07-31-2006, 11:24 AM
Would someone provide advice on how to have Windows Explorer open in a particular folder. The code below works as long as the folder name does not have characters in the folder name, e.g. commas.
Sub OpenExplorer()
Dim strFolderName As String
strFolderName = "C:\Demo, Level1"
Shell "Explorer.exe /e, /root," & strFolderName
End Sub
ghudson
08-09-2006, 05:24 PM
No, but you could use a custom browser function in your application if that will help your users.
Browse [Find a directory or file] (http://www.access-programmers.co.uk/forums/showthread.php?t=97787)
ghudson
08-09-2006, 05:28 PM
I once had a similar problem with file names that had a comma within the file name on a server. See if you can modify the code at this thread to meet your needs for I doubt a comma in a directory name is really necessary. Renaming Network Files (http://www.access-programmers.co.uk/forums/showthread.php?t=73500)
Birger Bjerkeng
05-08-2007, 05:43 AM
In order to have the Explorer open with a directory path containing comma, ensure that the foldername string is stored as quoted text, beginning and ending with ". To get the example mentioned to work, write
strFolderName = """C:\Demo, Level1"""
The Shell command string
"Explorer.exe /e, /root," & strFolderName
will then be:
Explorer.exe /e, /root,"C:\Demo, Level1"
and the comma is interpreted as part of the directory
instead of a command parameter separator
Alternatively (maybe better), keep the strFolderName as it is, and build the Shell command with
"Explorer.exe /e, /root,""" & strFolderName & """
GaryPanic
05-08-2007, 06:11 AM
This is something that I have been looking at and I cannot wrap my head around this
GH solution looks very good -
but I could not get it to work 100% - so I parked this for some time - until i had a clear moment - still parked - this solution GH is visually pretty good - and is the one i prefer -
sorry i cannot shed any light on the matter-