This routine will allow the user to select afile:
Sub testsel()
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim fDialog As FileDialog
Path = ActiveWorkbook.Path & "\"
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
'Optional: FileDialog properties
fDialog.AllowMultiSelect = False
fDialog.Title = "Select a file"
fDialog.InitialFileName = Path
'Show the dialog. -1 means success!
If fDialog.Show = -1 Then
fileselected = fDialog.SelectedItems(1)
fname = FSO.GetFileName(fileselected) 'The file name
End If
MsgBox fname
End Sub