RE: Importing unopened work*** into an open Workbook



Hi GrayesGhost

I hope this will help you.

Sub Retrieve_Info
P = "C:\MyDocumnets"
f = "Test.xls"
s = "Sheet1"

Application.ScreenUpdating = False
For r = 1 To 100
For c = 1 To 4
a = Cells(r, c).Address
Cells(r, c) = GetValue(P, f, s, a)
Next c
Next r
Application.ScreenUpdating = True
End Sub


Private Function GetValue(path, file, ***, ref)
' Retrieves a value from a closed workbook
Dim arg As String

' Make sure the file exists
If Right(path, 1) <> "\" Then path = path & "\"
If Dir(path & file) = "" Then
Exit Function
End If

' Create the argument
arg = "'" & path & "[" & file & "]" & *** & "'!" & _
Range(ref).Range("A1").Address(, , xlR1C1)

' Execute an XLM macro
GetValue = ExecuteExcel4Macro(arg)
End Function

Thanks
Bob

"GrayesGhost" wrote:

> If an unopened Excel Workbook only contains a single work***, is it
> possible to import the data from that work*** into another Workbook that is
> open, without having to open the other file?
.