Open all Excel files in a folder

This tutorial shows how to open all excel files in a specific folder at once using VBA

METHOD 1. Open all Excel files in a folder at once using VBA

VBA

Sub Open_all_excel_files_in_folder()
Dim FoldPath As String

Dim DialogBox As FileDialog

Dim FileOpen As String
On Error Resume Next
Set DialogBox = Application.FileDialog(msoFileDialogFolderPicker)
If DialogBox.Show = -1 Then

FoldPath = DialogBox.SelectedItems(1)

End If

If FoldPath = "" Then Exit Sub
FileOpen = Dir(FoldPath & "\*.xls*")

Do While FileOpen <> ""
Workbooks.Open FoldPath & "\" & FileOpen
FileOpen = Dir

Loop

End Sub

NOTES
Note 1: This VBA code will open all excel files at once that are located in a specified folder. The folder selection is done through a Dialog Box which will appear as you run the macro to allow you to select the folder in which you want to open all excel files.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to open a single workbook
How to open a single workbook as Read-Only