I want to use this routine Application.GetOpenFilename
to open either a *.txt
file OR a whole folder. Is this somehow possible?
E.g. if no file/folder is selected, the parent's folder path is returned, otherwise the selected filename?
Example: Let's assume I have a file called "test.txt"
in the path C:\folder1\folder2\test.txt
. Now I am lazy when searching files and select C:\folder1
(the "parent folder"). My program now searches within the subfolders for test.txt
. But sometimes I am not lazy and I want to select the specific file test.txt
I am searching for one user friendly dialog to handle both: open a folder (and return the folder path only) and open a file (and return the file path)
By
parent
I assume you mean the file from which the VBA is called. If not you should be able to adjust the below pretty easilly.