ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get all files from folder (https://www.excelbanter.com/excel-programming/370967-get-all-files-folder.html)

linglc

Get all files from folder
 
I want to open all files in a folder but do not want to use input box. Is
there a way of using something like the open files window (which pops open if
you click File - Open menu in excel)?

Muhammed Rafeek M

Get all files from folder
 
Try tis code:

Dim Fname As Variant

Fname = Application.GetOpenFilename("Excel Files (*.xls),*.xls", 3, "Select
a File to Open" ,, True)
If Not IsArray(Fname) Then
MsgBox "No file was selected."
Exit Sub
End If
For i = LBound(Fname) To UBound(Fname)
msg = msg & Fname(i) & vbCrLf ' This can be removed
Workbooks.Open Fname(i)
Next i
......
.....
exit sub



"linglc" wrote:

I want to open all files in a folder but do not want to use input box. Is
there a way of using something like the open files window (which pops open if
you click File - Open menu in excel)?



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

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