using Open File dialog in VBA

Copper Contributor

I am using vba code in MS Word [Office365].  When I display the Open File dialog for the user to select multiple files, it is not allowing me to select files from multiple folders..  I can however select multiple files from the same folder though.

Below is the code I have:

 

...

Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = True
...

 

3 Replies
In my tests, it is NOT possible to manually select files from multiple folders. So, not surprising that it cannot be done with code.

What were you wanting to be done with the files?
Thanks for your response Doug. I was helping my daughter to automate creating headers for about 150 Word documents. I am creating a list of files in a listbox and then process them one at a time.
Maybe, I should let her select files in a folder, save them and then let her go to another folder and select more files. When she is all done, I can start processing. I recently retired after 46 years of IT and getting back to programming to keep myself busy. I am sure I will be facing challenges but at the same time learning new stuff. THANKS again for your response.
The best thing to do is copy all of the files that are to be processed into a separate folder and you can then use a batch process to modify all of the file in that folder.

See the following page of Graham Mayor's website:

http://www.gmayor.com/document_batch_processes.htm