View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default is it possible to get an object without opening the book


Another method

Sub test()
MsgBox GetValue("C:\test", "A1.xls", "Sheet1", "A1")
End Sub

Function GetValue(path, file, sheet, range_ref)
Dim arg As String
If Right(path, 1) < "\" Then path = path & "\"
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
arg = "'" & path & "[" & file & "]" & sheet & "'!" & _
Range(range_ref).Range("A1").Address(, , xlR1C1)
GetValue = ExecuteExcel4Macro(arg)
End Function


--
http://www.vba.com.tw/plog/


"EXCEL NEWS" wrote:

hi,

is it possible to get an object without opening the book
i mean ,for instance how to get a cell value without opening the book in vba

thanks