0

In my VBA application, I'm opening a FileDialog and waiting for the user to select a file.

FileDialog.Show displays the contents of the folder and waits until the user makes a selection. Once the user selects a file, the window that lists the files closes.

After they have selected a file I run a VBA command to open the file they selected.

Question: Is there a way to leave the display of the contents of the folder open so a user could select another file from the list (and open it), without closing the window and reopening it (by calling the FileDialog.Show command again)? On our network server, there is a 10-20 second delay opening the folder in the first place and it would speed up users' interaction with the system if the list of files in the folder just remained open, so they could double-click another file from the window and open it.

3
  • 3
    I don't think so. Maybe AllowMultiselect is an option, so that the user can select all the files at once? Commented Sep 6, 2024 at 15:25
  • There is a way. -1- The first time the user selects a file, you loop thru the selected directory (!) with the command Dir(). -2- Store the results - the files and paths of subfolders - into a comma seperated string. -3- create a seperate form where you have a listbox. -4- open the form, even with acDialog. -5- feed the stored results as rowsource of the listbox. -6- put some code in the name_of_listbox_Click() event. Commented Sep 6, 2024 at 21:01
  • Direct answer: No. But a work-around has been suggested. Commented Sep 7, 2024 at 1:49

2 Answers 2

0

Good suggestion. Thanks. Also, an option would be to read the list of files into a temp table and display the filenames on a form, which would allow a user to sort them, etc. Thanks.

I would mark the above suggestion as an answer, but I can't mark a Comment as an Answer. If you want to copy the text to an Answer, I'll get you credit for it.

Sign up to request clarification or add additional context in comments.

Comments

0

There is a way to work around it.

  1. The first time the user selects a file, you loop thru the selected directory (!) with the command Dir().
  2. Store the results - the files and paths of subfolders - into a comma seperated string.
  3. Create a seperate form where you have a listbox.
  4. Open the form, even with acDialog.
  5. Feed the stored results as rowsource of the listbox.
  6. Put some code in the name_of_listbox_Click() event

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.