Created
March 9, 2015 16:08
-
-
Save kissmygritts/27c8063b188642cd7ace to your computer and use it in GitHub Desktop.
Select a file with the Microsoft file dialog. Requires reference to Microsoft Object Library x.x, where x.x is the version number. title, start and filter correspond to Dialog Box title, the start directory and extension filters to apply.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function PickFile(title As String, start As String, filter As String) As String | |
Dim dlg As FileDialog | |
Set dlg = Application.FileDialog(msoFileDialogFilePicker) | |
With dlg | |
.title = title | |
.InitialFileName = start | |
.AllowMultiSelect = False | |
.Filters.Clear | |
.Filters.Add filter, "*." & filter & "*", 1 | |
If .Show = True Then | |
PickFile = .SelectedItems(1) | |
Else | |
Exit Function | |
End If | |
End With | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment