I'm trying to allow the user to select multiple files - both xlsx
and csv
- however I can't get the popup box to show both file types.
I can only select between xlsx
and csv
.
But I'd like them shown together.
I've tried every combination I can think of, including copying from tutorials, but the GetOpenFilename
object always fails.
Adding an ampersand &
myFile = Application.GetOpenFilename(MultiSelect:=True, FileFilter:="Excel Files (*.xls*), *.XLS* & CSV Files (*.csv),*.CSV", Title:="Select Files To Be Opened")
Adding extra quotation marks "
myFile = Application.GetOpenFilename(MultiSelect:=True, FileFilter:="Excel Files (*.xls*), *.XLS*" & "CSV Files (*.csv),*.CSV", Title:="Select Files To Be Opened")
Adding both file types to parenthesis:
myFile = Application.GetOpenFilename(MultiSelect:=True, FileFilter:="Excel Files (*.xls*,*.csv), *.XLS*,*.CSV", Title:="Select Files To Be Opened")
Everything I try fails.
It is actually possible to do this right? It must be a simple mistake like a missing comma somewhere.
Try this way, please:
myFile = Application.GetOpenFilename(MultiSelect:=True, _
FileFilter:="Excel/CSV Files: ,*.xlsx;*.csv", Title:="Select Files To Be Opened")
Extensions must be separated by ";".
You can find all parameters documented here.