ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting a list of filenames (https://www.excelbanter.com/excel-programming/327361-re-getting-list-filenames.html)

Bernie Deitrick

Getting a list of filenames
 
You can use teh multiselect property to allow the selection of multiple
filenames, using ctrl-clicks or shift-clicks:

Sub test()
Dim FName As Variant
Range("A1:A100").ClearContents
FName = Application.GetOpenFilename("Excel files(*.XLS),*.XLS", , , , True)
On Error GoTo NonSelected
Range("A1").Resize(UBound(FName)).Value = Application.Transpose(FName)
Exit Sub
NonSelected:
MsgBox "User cancelled"
End Sub


HTH,
Bernie
MS Excel MVP


"cottage6" wrote in message
...
Hello and HELP!
I'm using the following code to insert the selected filename into a cell.
What I really need is for the user to be able to select multiple files and

to
get those names into some sort of list so the user can select a file from
that group. Is that possible? Remember when giving me a solution that

I'm
not as slick as I could be creating code, so please include explicit
instructions! Thanks.

Dim FName As Variant
FName = Application.GetOpenFilename("Excel files(*.XLS),*.XLS")
If FName < False Then
Range("A1").Select
ActiveCell = FName
Else
MsgBox "User cancelled"
End If





All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com