Using ExecuteExcel4Macro and Office 2010
Using the function below grabs a value from a closed workbook.
It has worked perfectly for years (Excel 97 up to Excel 2007)
On upgrade to Excel 2010 the ExecuteExcel4Macro now produces an Error 2023. has anyone come across this - and if so have you found any quick solution?
[vba]
'===================================================================
' Gets value from a cell - GetLastSheet will already have established
' that the file and sheet exist so this is the simple version
'
Function GetValue(Path, File, Sheet, Ref)
Dim Arg As String
GetValue = 0
' Create the argument
Arg = "'" & Path & "[" & File & "]" & CStr(Sheet) & "'!" & _
Range(Ref).Range("A1").Address(, , xlR1C1)
' Execute the macro
GetValue = ExecuteExcel4Macro(Arg)
End Function
[/vba]