usage with a startup folder:
Code:
vRet = UserPick1File( "c:" )
if vRet <> "" then txtBox = vRet
paste code below into a module:
Code:
Public Function UserPick1File(byval pvPath) 'ByVal pvFilter, Optional pvPath)
Dim strTable As String
Dim strFilePath As String
Dim sDialogMsg As String, sDecr As String, sExt As String
Const msoFileDialogFilePicker = 3
Const msoFileDialogViewList = 1
'Application.FileDialog(msoFileDialogSaveAs) =2 'SAVE AS
'Application.FileDialog(msoFileDialogFilePicker) =3 'file OPEN
With Application.FileDialog(3)
.AllowMultiSelect = True
.Title = sDialogMsg ' "Locate a file to Import"
.ButtonName = "Import"
.Filters.Clear
'.Filters.Add sDecr, sExt
'.Filters.Add "Access Files", "*.accdb;*.mdb"
'.Filters.Add "Excel Files", "*.xlsx"
.Filters.Add "All Files", "*.*"
.InitialFileName = pvPath
.InitialView = msoFileDialogViewList 'msoFileDialogViewThumbnail
If .show = 0 Then
'There is a problem
Exit Function
End If
'Save the first file selected
UserPick1File = Trim(.SelectedItems(1))
End With
End Function