Skip to content

Instantly share code, notes, and snippets.

@harsha547
Created June 8, 2017 17:32
Show Gist options
  • Save harsha547/1001fd563301662d0bc24eb9aec95982 to your computer and use it in GitHub Desktop.
Save harsha547/1001fd563301662d0bc24eb9aec95982 to your computer and use it in GitHub Desktop.
Sub GettingFile()
Dim SelectedFile As String
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Select File"
.ButtonName = "Confirm"
.InitialFileName = "C:\"
If .show = -1 Then
SelectedFile = .SelectedItems(1)
MsgBox SelectedFile
Else
'Cancel Clicked
End If
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment