excell4.0메크로를 사용하시면 될듯합니다.
불러올 파일과 기록할 파일이 같은 폴더에 있다고 가정합니다.
불러올 파일 이름이 XLM_1.XLS 일때
기록할 파일의 B2:B4셀에
XLM_1.XLS 파일의 Sheet1 시트의 A1:A3셀의 데이타를 불러오는 경우의 코드입니다.
참조하시고 좋은 결과 있으시길~~~
Option Explicit
Sub Call_Data()
Dim strPath As String, strFile As String, strSht As String, strCell As String
Dim i As Integer
strPath = ThisWorkbook.Path & "\"
strFile = "XLM_1.xls"
strSht = "Sheet1"
For i = 0 To 2
strCell = Range("a1").Offset(i, 0).Address
Range("b2").Offset(i, 0) = Get_Data(strPath, strFile, strSht, strCell)
Next
End Sub
Function Get_Data(Path, File, Sht, Cell)
Dim strD As String
strD = "'" & Path & "[" & File & "]" & Sht & "'!" & Range(Cell).Address(, , xlR1C1)
Get_Data = ExecuteExcel4Macro(strD)
End Function
반응형
'VBA' 카테고리의 다른 글
Sheet를 다른 엑셀 파일로 복사하는 VBA (0) | 2011.09.10 |
---|---|
vba로 Access2007 파일 불러오기(SQL이 된다) (0) | 2011.07.12 |
엑셀, 파일열지않고 값 복사해오기 (0) | 2011.07.08 |
엑셀 두개의 파일 업데이트 (0) | 2011.07.08 |
vba 문법 짜증난다. (0) | 2011.05.06 |