Filename picker

Paul200968

Registered User.
Local time
Today, 16:20
Joined
Apr 3, 2006
Messages
14
Hi all,
Im looking for an object which looks like a filebrowser and when I select a file, the path (preferable the UNC path) is recorder in an access database.
Currently im typing over the location of a file and record this information into a database.

rgrds,

Paul.
 
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

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

Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)

Else
BrowseFolder = vbNullString
End If
End Function

and you call like this...
Dim strFolderName As String
strFolderName = BrowseFolder("What Folder you want to select?")
 

Users who are viewing this thread

Back
Top Bottom