Consulting

Results 1 to 3 of 3

Thread: get value from not opened excel file sheet.

  1. #1

    get value from not opened excel file sheet.

    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

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    This worked for me. Be sure to correct the path.
    [VBA]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[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    Hi kalu,

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

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

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •