msoFileDialogFilePicker with filter

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
 
R

RonaldoOneNil

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
 
M

Mark Kubicki

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top