PDA

View Full Version : get value from not opened excel file sheet.



kalu
01-05-2010, 07:38 PM
Greetings to everyone out here in this fourm.
can any one please guide me how can i get value from an unopened excel sheet so that i can check the value and popup message.
i'm trying to do by using personal.xls but i have "myvalue.xls" from which sheet1 i have to check the value. Professionally i'm not a programmer so i have no solid knowledge of variables loops etc.
here is my logic which i need to put in personal.xls


IF
c:\data\myvalue.xls\sheet1(row3)>today
then
msgbox "time has expired
else
msgbox "everyone is okay"
end if

my main problem over here is how to code checking the value of an unopened xls file
thanks in advance
kalu

lucas
01-05-2010, 10:53 PM
This worked for me. Be sure to correct the path.
Sub RetrieveValues()
Dim wb As Workbook
Dim rCheck As Range
Dim rCl As Range
Application.ScreenUpdating = False ' turn off the screen updating
Set wb = Workbooks.Open("C:\Temp\myvalue.xls", True, False)
With wb.Worksheets("Sheet1")
Set rCheck = .Range(.Cells(2, 3), .Cells(.Rows.Count, 3).End(xlUp))
For Each rCl In rCheck
If rCl.Value < Date Then MsgBox rCl.Offset(0, -2) & " time expired"
Next rCl
End With
wb.Save
wb.Close
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating
End Sub

rbrhodes
01-06-2010, 08:46 PM
Hi kalu,

This works really well and is easy to use (for me at least)

http://www.rondebruin.nl/ado.htm