PDA

View Full Version : Word - List of files in listbox + insert selected



Ricco
04-23-2018, 05:26 AM
Hello everyone,

I am new to vba and I am looking for a macro that:
1 / list in a listbox the name of the word files (without extension) present in a directory
2 / a button to insert, in the active document, the contents of one of the files selected in the drop-down list

thank you in advance for your lighting :hi:

gmayor
04-24-2018, 03:58 AM
The attached zip contains a simple template - open it up and the userform will show.
It has a button on the QAT that will call the form should you use it as an add-in.
I don't like the idea of using it to show all Word compatible documents, as this can create problems when you insert them, so thew form only shows docx format documents.
Take a look at http://www.gmayor.com/Userform.htm which shows how to insert userform data other than at the cursor.
See also https://www.gmayor.com/select_document_template.htm

Ricco
04-24-2018, 08:34 AM
Thank you very much GMayor, I try it and I come back to you.
Have a nice day :content: