View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default pulling information from a closed workbook (revised)

Ron de Bruin posted this in response to your previous post:

Maybe this
http://www.rondebruin.nl/copy7.htm

But for a whole sheet I think you can better open the workbook and copy the
sheet to your workbook


--
Regards,
Tom Ogilvy


"edluver" wrote:

i am sorry, the code in the original post is not correct, it should be this:

Function 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 Function


Sub test1()
GetValuesFromAClosedWorkbook "E:", "Book1.xls", "Sheet1", "A4:J4"
End Sub

sorry for the confusion.