ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Let user choose multiple files? (https://www.excelbanter.com/excel-programming/448089-let-user-choose-multiple-files.html)

Robert Crandal[_2_]

Let user choose multiple files?
 
I am looking for an easy way to let users choose
multiple files all at once. Is the built-in FileDialog()
function my only choice?? I am curious if there are other
options for letting users drag and drop multiple files into a
form or dialog box??

Please let me know. Thanks!

Robert.



isabelle

Let user choose multiple files?
 
hi Robert,

Sub sDialogFilePicker()
Dim fd As FileDialog
Dim oFile As String

Dim sFileName As String

Set fd = Application.FileDialog(msoFileDialogFilePicker)

With fd
.AllowMultiSelect = True
.Show

On Error Resume Next
If Err.Number < 0 Then Err.Clear: Exit Sub


For i = 1 To .SelectedItems.Count
Debug.Print .SelectedItems(i)
Next

End With
End Sub

isabelle


Le 2013-01-30 03:07, Robert Crandal a écrit :
I am looking for an easy way to let users choose
multiple files all at once. Is the built-in FileDialog()
function my only choice?? I am curious if there are other
options for letting users drag and drop multiple files into a
form or dialog box??

Please let me know. Thanks!

Robert.



Robert Crandal[_2_]

Let user choose multiple files?
 
Thank you Isabelle. You're always very helpful! 8)


"isabelle" wrote in message ...
hi Robert,

Sub sDialogFilePicker()
Dim fd As FileDialog
Dim oFile As String

Dim sFileName As String

Set fd = Application.FileDialog(msoFileDialogFilePicker)

With fd
.AllowMultiSelect = True
.Show

On Error Resume Next
If Err.Number < 0 Then Err.Clear: Exit Sub


For i = 1 To .SelectedItems.Count
Debug.Print .SelectedItems(i)
Next

End With
End Sub

isabelle


Le 2013-01-30 03:07, Robert Crandal a écrit :
I am looking for an easy way to let users choose
multiple files all at once. Is the built-in FileDialog()
function my only choice?? I am curious if there are other
options for letting users drag and drop multiple files into a
form or dialog box??

Please let me know. Thanks!

Robert.




joeu2004[_2_]

Let user choose multiple files?
 
"Robert Crandal" wrote:
I am looking for an easy way to let users choose
multiple files all at once.


I do it this way.

Dim fnames As Variant
fnames = Application.GetOpenFilename(MultiSelect:=True)
If TypeName(fnames) = "Boolean" Then Exit Sub
For i = 1 To UBound(fnames)
Debug.Print fnames(i)
Next i


All times are GMT +1. The time now is 04:04 PM.

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