Skip to content

Instantly share code, notes, and snippets.

@timotewb
Created January 17, 2021 10:43
Show Gist options
  • Save timotewb/7026533afe1fbbfb1ab5f41c1e47f1f4 to your computer and use it in GitHub Desktop.
Save timotewb/7026533afe1fbbfb1ab5f41c1e47f1f4 to your computer and use it in GitHub Desktop.
Public Function fileNamePath() As String
'--- fileNamePath()
' in: n/a
' out: string, path and name of selected file
' desc: opens an explorer window so the user can select a file. No file type filters are applied.
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Title = "Select file"
.AllowMultiSelect = False
If .Show = True Then
fileNamePath = .SelectedItems(1)
End If
End With
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment