Open instance of Windows File Explorer from VBA using filter

Using MSAcess VBA  to open Windows File Explorer in a specific folder with a specific filter. Online I see many instances of generating a file picker, that is not what I want. I Want the list of files to be displayed within Windows File Explorer as if I had manually filtered it.

The attached file shows the VBA code that I have so far...........basically I have the filter created and now I need to add the code to open Windows Explorer with the filter.
Rick RudolphAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Dev-Soln LLCCommented:
I'm not sure I understand the purpose of opening the file dialog.  You either need to open it to either save a file, or open (select a file, or multiple files).  Although you don't actually have to implement code to save or open the file.

Which of these do you want to perform?

You can apply filters to the Open (msoFileDialogFilePicker) but cannot do so with the the Save (msoFileDialogSaveAs) operation.

Sample code for selecting a file:

Dim fDialog As FileDialog, result As Integer
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
'Optional: FileDialog properties
fDialog.AllowMultiSelect = False
fDialog.title = "Select a file"
fDialog.InitialFileName = "C:\"

'Optional: Add filters
fDialog.Filters.Add "Access files", "*.md*,*.accd*"
fDialog.Filters.Add "Excel files", "*.xlsx"
fDialog.Filters.Add "All files", "*.*"

'Show the dialog. -1 means success!
If fDialog.Show = -1 Then
   Debug.Print fDialog.SelectedItems(1)
End If

Open in new window

You can also select multiple files by placing this line before line 15 in the previous code segment.
fDialog.AllowMultiSelect = True

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John TsioumprisSoftware & Systems EngineerCommented:
If you want to Open Windows Explorer here is an example:
Rick RudolphAuthor Commented:

In answer to your question, I have no idea what the user will be doing with the files when they see the windows file explorer list. They may just be interested to see if a certain file exists, or they may want to open it. In every case, if they want to open a file, they will use the default Windows Program to open the they will double click on the file in which they are interested.

So I have not had an opportunity to review what John has recommended, it  does however on the surface sound a little more in line with what I need to provide.

I already have a solution for picking files to either save or pass back to the executing function.


Dale FyeOwner, Dev-Soln LLCCommented:
If all you are interested in doing is allowing the user to open Windows Explorer from within the application, then John's solution (shelling out to Explorer.exe) should work.


Open in new window

Rick RudolphAuthor Commented:
Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.