我需要一些帮助才能将多个工作簿集成到一个主工作簿中。我试图使用以下宏代码。问题是它没有进入do while循环。我也验证了这条道路。 Kindle帮助
Sub GetSheets()
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro"
Filename = Dir(Path & "*.xls")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
答案 0 :(得分:1)
替换它:
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro"
Filename = Dir(Path & "*.xls")
用这个:
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro\"
Filename = Dir(Path & "*.xls")
您错过了\