Here is a function I wrote to do just that:
Code:
Function Select_File(Current_Location As Variant, Dialog_Title As String) As Variant
On Error GoTo errproc
Dim CurrentProcedure As Variant
CurrentProcedure = "Select_File"
Dim fd As FileDialog
Dim ReturnPath As Variant, ReturnValue As Integer
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'
' Initialize the directory with the current value
'
If IsNull(Current_Location) Then
fd.InitialFileName = "C:\"
Else
fd.InitialFileName = Current_Location
End If
fd.title = "Select a file for " & Dialog_Title
ReturnValue = fd.Show
If ReturnValue <> 0 Then
'
' Dialog was not closed with "Cancel"
'
' MsgBox "Returned Value = " & ReturnValue
Select_File = fd.SelectedItems(1)
Else
'
' Return value is the same as the initial value
'
Select_File = Current_Location
End If
Set fd = Nothing
Exit Function
errproc:
' whatever error processing you need
End Function