RE: Importing unopened work*** into an open Workbook
- From: Bob <Bob@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 15 Apr 2005 00:14:03 -0700
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?
.
- Prev by Date: Simple problem
- Next by Date: RE: Importing unopened work*** into an open Workbook
- Previous by thread: Simple problem
- Next by thread: RE: Importing unopened work*** into an open Workbook
- Index(es):