Listing Files and Directories in User Form

D

dsc

I created a user form with a list box, but can't figure out how to get
directories and files to show up.

Any assistance appreciated. I mean, I haven't tried to do this since they
were called dialog boxes.
 
D

Doug Robbins - Word MVP

Hi dsc,

What do you want to do with the selection that the user might make in the
list box? It might be better to have a button on the userform call the
dialog that is appropriate for the purpose.

For example, if you wanted to get the filename of a picture that the user
selects, you can use

' Display the InsertPicture dialog
With Dialogs(wdDialogInsertPicture)
If .Display Then
'Populate the txtLargeLogoPath control with the selected
filename
txtLogoPath = WordBasic.FilenameInfo$(.Name, 1)
End If
End With

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
D

dsc

Thanks for the reply, Doug.

I have some macros that let me do things with files.

My old dialogs have a drop-down list that lets me select a directory, a
drop-down list that lets me select an extension, a directory list for
selecting directories, and a list of the files inside a directory.

I can then open all files with (for instance) the .txt extension, or open
all into the same file, or save all .doc files as text files, or delete all
..doc files, etc

None of my old code seems to work with these user forms. Even the keywords
seem to be changed or gone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top