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

Determining Path Only of CommonDialog

Status
Not open for further replies.

rcsenar

Programmer
Nov 17, 2001
8
0
0
US
This has to be easy, but my scrambled brain can't figure it out.

I know that CommomDialog.FileName gives me the full path and file name of a selected file. I just want the user to select a directory, not a specific file.

Do I use CommonDialog?
If yes:
What is the easiest way to parse out just the path?
How do I allow for the selection of just a directory...not a unique file name?

If no:
What can I use?

Thanks in advance.

Rob
 
This will parse out the path after a selection from a CommonDialog. You could also use a DriveListBox and a DirListBox. Each method has it's disadvantages. The CommonDialog requires the user to select a file, even if you just want the folder.

Public Function JustPath(ByVal strFilePath As String) As String
JustPath = Left(strFilePath, InStrRev(strFilePath, "\"))
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top