JamieArvato
Technical User
Hi, I'm looking at pulling in data from several workbooks into one.
Some of these workbooks will be open by another user some wont.
I was originally looking to set-up code to create 15 ODBC links each time I ran it but thought that there must be an easier way to copy and paste without opening the files?!
I have the following code off an internet site but it just brings back #REF's
Sub test()
GetValuesFromAClosedWorkbook "X:\", "File1.xls", _
"DataRange", "A1:K1000"
End Sub
Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With Sheets("Sheet5").Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Sub
thanks
Some of these workbooks will be open by another user some wont.
I was originally looking to set-up code to create 15 ODBC links each time I ran it but thought that there must be an easier way to copy and paste without opening the files?!
I have the following code off an internet site but it just brings back #REF's
Sub test()
GetValuesFromAClosedWorkbook "X:\", "File1.xls", _
"DataRange", "A1:K1000"
End Sub
Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With Sheets("Sheet5").Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Sub
thanks