ExecuteExcel4Macro从封闭的工作簿中获取范围/图表

我使用这些行来从封闭的工作簿中获取值:

Arg = "'" & Path & "[" & File & "]" & Sheet & "'!" & "R4C4" Arg = CStr(Arg) GetValue = ExecuteExcel4Macro(Arg) 

除了循环以外,还有其他方法来获取范围内的值吗? 循环解决scheme正在工作,但如果我可以直接与ExecuteExcel4Macro获得范围将更清晰。 我试图在Arg中input一个范围,但它不起作用。 它返回一个错误。

我对图表有同样的问题,我怎么能得到它们? 我现在的解决scheme是获取价值和重新绘制图表。 它的工作原理,但我会更快乐的GetChart(Chartname)函数。

我已经看到,我可以使用ADODB连接从封闭的工作簿中获取值。 但是与ExecuteExcel4Macro相比,它有些复杂。 在范围/图表的情况下使用ADODB连接会更容易吗?

以下几行代码从closures的工作簿中的范围中提取信息,并将其复制到Active Workbook中的相同范围中:

  Sub GetRange() With Range("A1:D50") 'set range to copy from / to. .Formula = "='C:\E3_Test\[CC_Data.xlsx]AllData'!A1" 'refers to a workbook, sheet and first cell. 'It will put the relative references into the target sheet correctly. .Value = .Value 'changes formula to value. End With End Sub