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

browse for folder

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
I'am using the code below to choose a folder.
The dialog box opens in the strStartDir (R:\testdir\test).
Now it is not possible to go back to a higher folder or drive.
Can someone edit this code so I can select another drive ?

Code:
Public Function PickFolder(strStartDir As Variant) As String
Dim SA As Object, f As Object
Set SA = CreateObject("Shell.Application")
Set f = SA.BrowseForFolder(0, "Choose a folder", 16 + 32 + 64, strStartDir)
If (Not f Is Nothing) Then
  PickFolder = f.Items.Item.Path
End If
Set f = Nothing
Set SA = Nothing
End Function
 
Hi,

Maybe assign another value like strStartDir = "R:\testdir"???

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Whilst I am a big fan of the shell's BrowseForFolder method it does have some limitations - and you have encountered one: it only allows you to set a root folder, rather than a simple start folder, above which you cannot browse.

The underlying API call on which this method are based do allow you to set a simple starting folder. Of course using the API is more complex. An example is presented by Hypetia here: thread222-498611
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top