msoFileDialogFilePicker with filter

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
M

Mark Kubicki

I have the below code to select a *.JPG file...
My question is simple:

How would I modify (is it possible to modify) the code to also include *.BMP
files BUT still leave *.JPG as the default?


With Application.FileDialog(3) ' 3 is a constant: msoFileDialogFilePicker
.Title = "Select page"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPGs", "*.JPG"
.FilterIndex = 4
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
Result = .Show

much thanks in advance,
mark
 
Not tested but use trial and error on the FilterIndex
With Application.FileDialog(3) ' 3 is a constant: msoFileDialogFilePicker
.Title = "Select page"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPGs", "*.JPG"
.Filters.Add "BMP's", "*.BMP"
.FilterIndex = 1
 
almost perfect THANKS...
(.FilterIndex = 2)


RonaldoOneNil said:
Not tested but use trial and error on the FilterIndex
With Application.FileDialog(3) ' 3 is a constant: msoFileDialogFilePicker
.Title = "Select page"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPGs", "*.JPG"
.Filters.Add "BMP's", "*.BMP"
.FilterIndex = 1
 
Back
Top