selectfile control

A

al ramirez

i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance
 
B

Bob Flanagan

The example below will display the Windows directory dialog and let a user
select any directory. It will return the path to that directory.

Place this type declaration and the next two functions at
'the top of the module
Public Type BROWSEINFO
hWndOwner As Long
pidlRoot As Long
sDisplayName As String
sTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _

(ByVal pidl As Long, ByVal pszPath As String) As Long

Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" _
(lpBrowseInfo As BROWSEINFO) As Long

Sub DemoGetPath()
Dim anyPath As String
anyPath = DirectoryName("Select destination folder")
If anyPath = "" Then
MsgBox "No directory selected"
Else
MsgBox anyPath
End If

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
A

al ramirez

Thanks Bob but:
DirectoryName("Select destination folder") is not defined,
how do I use it, and what those 2 functions do?, can you
elaborate a little bit more?. I'm a beginer.
thanks again. Al
 
T

Tom Ogilvy

If you want the approach explained, with a complete example, then you might
check the link I provided.
 
Top