반응형

strpath = ThisWorkbook.Path
Path = Left(strpath, InStrRev(strpath, "\") - 1)
Path = Path & "\";strFile = "파일명.xls"
strSheet = "쉬트명"
strAddress = Cells(X,Y).Address
변수 = ReadValue(Path, strFile, strSheet, strAddress)


펑션
Function ReadValue(Path, File, sht, Rng) As Variant
Dim Msg As String
Dim strTemp As String
If Trim(Right(Path, 1)) <> "\" Then Path = Path & "\"
'데이터가 있는 원본 파일이 없으면 에러를 표시 매크로를 종료.
If Dir(Path & File) = "" Then;ReadValue = "해당 파일이 없습니다"
Exit Function
End If
Msg = "'" & Path & "[" & File & "]" & sht & "'!" & Range(Rng).Range("a1").Address(, , xlR1C1);ReadValue = ExecuteExcel4Macro(Msg)
End Function

은근 쓸일이 많은 옵션
반응형

+ Recent posts