如何将文件名检索到“标签”名称中? (又名工作表名称)

时间:2019-05-22 10:52:15

标签: excel vba

此代码将批处理文件迁移到1个主文件中。 我希望能够保留选项卡名称(sheet1,sheet2等。)作为文件名。

Sub GetSheets()

'Update ExcelJunction.com

Path = ""

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

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 个答案:

没有答案