我在Excel中收到有关使用以下代码分配给只读属性的错误:
1 Sub GetSheets()
2 Path = "C:WHERE MY DOCUMENTS ARE KEPT"
3 Filename = Dir(Path & "*.CSV")
4 Do While Filename <> ""
5 Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
6 For Each Sheet In ActiveWorkbook.Sheets
7 Sheet.Copy After:=ThisWorkbook.Sheets(1)
8 Next Sheet
9 Workbooks(Filename).Close
10 Filename = Dir()
11 Loop
12 End Sub
答案 0 :(得分:3)
我猜你在limits
模块中有发布的代码?
ThisWorkbook
表示工作簿本身,它具有内置(只读)ThisWorkbook
属性。
将Path
重命名为(例如)Path
,您应该没问题。
myPath