Combining multiple excel workbooks into one

Trevor Johnson 0 Reputation points

I am having trouble with a '424' error code with visual basic.

I am trying to combine hundreds of old excel workbooks into one single workbook, that inlcudes all the sheets from each workbook in a folder directory.

Here is the code i am working with. Any chance you can see

Sub GetSheets()

Dim Sheets As Object

Dim ActvieWorkbook As Object

Path = "C:\Users\xxxx\xxxx\xxxx"

Filename = Dir(Path & "*.xls")

Do While Filename <> ""

Workbooks.Open Filename:=Path & Filename, ReadOnly:=True

For Each Sheets In ActvieWorkbook.Sheets()

Sheet.Copy After:=ThisWorkbook.Sheets(1)

Next Sheets


Filename = Dir()


End Sub

User's image

User's image

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
2,690 questions
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,095 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,057 questions
{count} votes