Mega Code Archive

 
Categories / VisualBasic Script / File Path
 

You can use the Add method of the FileDialogFilters collection object to create your own list of filter

Sub fileDlg()     Dim fd As FileDialog     Dim imagePath As String     Set fd = Application.FileDialog(msoFileDialogFilePicker)     With fd         .AllowMultiSelect = False         .Filters.Clear         .Filters.Add "All files", "*.*"         .Filters.Add "Image", "*.jpg", 1         .FilterIndex = 1         .InitialFileName = ""         .Title = "Select JPEG file"         If .Show = -1 Then       'User pressed action button             imagePath = .SelectedItems(1)         End If     End With End Sub