469,327 Members | 1,323 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

select directory not file..

I'm looking for a way to select a directory from a local drive through a
form (like input type="file" except I want to get a directory name not just
a file). I've searched every way I could think of (refer to my brain comment
above) and come up with absolutly nothing.

Any ideas, help or pointers are appreciated.

With Regards,
Sushil Singh
----------------------
Stay not Stop
Jul 23 '05 #1
2 7042
rf
Sushil wrote:
I'm looking for a way to select a directory from a local drive through a
form (like input type="file" except I want to get a directory name not just a file). I've searched every way I could think of (refer to my brain comment above) and come up with absolutly nothing.

Any ideas, help or pointers are appreciated.


You can not do this.

--
Cheers
Richard.
Jul 23 '05 #2
"Sushil" <sk****@dataarmor.net> wrote in message
news:fd**************************@posting.google.c om...
I'm looking for a way to select a directory from a local drive through a
form (like input type="file" except I want to get a directory name not just a file). I've searched every way I could think of (refer to my brain comment above) and come up with absolutly nothing.

Any ideas, help or pointers are appreciated.

With Regards,
Sushil Singh
----------------------
Stay not Stop

MsgBox BrowseForFolder("File","Browse for a file","")
MsgBox BrowseForFolder("Folder","Browse for a folder","")

Function BrowseForFolder(sBFF,sPMT,sDIR)
BrowseForFolder = ""
If sBFF <> "Folder" And sBFF <> "File" Then Exit Function
'*
Dim objSHL
Set objSHL = CreateObject("Shell.Application")
Dim objB4F
'*
On Error Resume Next
If sBFF = "Folder" Then
Set objB4F = objSHL.BrowseForFolder(&H0,sPMT,&H0031,sDIR)
Else
Set objB4F = objSHL.BrowseForFolder(&H0,sPMT,&H4031,sDIR)
End If
BrowseForFolder = objB4F.ParentFolder.ParseName(objB4F.Title).Path
If Err.Number <> 0 Then BrowseForFolder = ""
'*
Set objB4F = Nothing
Set objSHL = Nothing
End Function

However, this requires a Microsoft control (MSCOMCTL.ocx, I think) that is
not installed on most PCs; you do get it with a Visual Studio installation,
though.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sergey Poberezovskiy | last post: by
3 posts views Thread by Sergey Poberezovskiy | last post: by
2 posts views Thread by ghighi | last post: by
1 post views Thread by vicsauer | last post: by
2 posts views Thread by Jeff Gaines | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.