以下代码给出错误“下标超出范围”:
Sub Workbooks2(str)
Workbooks.Open (ThisWorkbook.path & "\" & str)
Workbooks(ThisWorkbook.path & "\" & str).Close ' <<<<< subscript out of range error
End Sub
答案 0 :(得分:0)
以下工作原理(在“关闭”命令中删除了文件的路径):
Sub Workbooks2(str)
Workbooks.Open (ThisWorkbook.path & "\" & str)
Workbooks(str).Close
End Sub