View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AshMorK AshMorK is offline
external usenet poster
 
Posts: 24
Default Evaluate text string as formula

Hi Everyone,

I have the following code to get a a cell linked to another workbook, but
when i call the function it returns a #REF!.
The function is trying, for example, to do the following:
Evaluate (='H:\bravhec\[Book1.xls]Sheet1'!A1)


Function GetRange(FilePath As String, FileName As String, SheetName As
String, _
SourceRange As String)
Dim link As String

'Add formula links to the closed file
link= "='" & FilePath & "\[" & FileName & "]" & SheetName _
& "'!" & SourceRange

Application.CutCopyMode = False
GetRange = Evaluate(Link)
End Function

thanks in advance!