How do I get a range of cells from a closed workbook in a VBA code run on another workbook?
I am trying the ExecuteExcel4Macro() function. I can not get it to work for a range of more than one cell.
答案 0 :(得分:0)
我不认为有办法使用ExecuteExcel4Macro访问范围。使用ADO
可能会有更好的结果你也可以尝试这样的事情:
Sub getARange()
With Range("A2:B4")
.Formula = "='C:\[source.xlsx]Input'!A2"
.Value = .Value
End With
End Sub
以上内容会将其复制到您当前的工作簿中。您可能希望执行此类操作或根据您的要求将其存储在范围变量中。