View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
lieven lieven is offline
external usenet poster
 
Posts: 10
Default importing data from closed workbook

Hi,

I'm using below function to import data from a closed workbook :

Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Sub

I am now trying to assign the result directly to a variable, but the
following fails :

myvar=application.evaluate("''c:\Myworkbook[Mysheet]'!A1:Q250")

Anyone got any ideas why , or a solution to the problem ?