Excel VBA에서 Excel 파일을 열지 않고 컨텐트에 액세스하는 방법

Public Function GetCellValue(strPath, strFile, strSheet, strA1)
    If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
    If Dir(strPath & strFile) = "" Then     '        
        '             ,               
        Err.Raise 12345, "GetCellValue", "No found file"
        Exit Function
    End If
    '  XLM4.0             
    '          ,    
    GetCellValue = ExecuteExcel4Macro("'" & strPath & "[" & strFile & "]" _
        & strSheet & "'!" & Range(strA1).Address(, , xlR1C1))
End Function

좋은 웹페이지 즐겨찾기