Sign in to follow this  
Followers 0
electrico

Excel help

4 posts in this topic

Hi guys! I am exhausted with one mission I need to be completed.

I have an excel document. The cells E1:E25 contains dates. And I need the script to watch data in these cells, and if the date in some of these cells is the date that will come after the month, the message box like "Hurry up please, you have only 1 month!" is popup. Cant complete this alone. Can you help me, please?

Share this post


Link to post
Share on other sites



I was trying to set this up for you, however, it is dependant on the excel format returned in YOUR sheet.

#include <Excel.au3>
#include <Date.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelWriteCell($oExcel,  _NowCalc(), "E1") ;Write to the Cell
_ExcelWriteCell($oExcel, "2009/06/23 00:00:00", "E25") ;Write to the Cell

While IsObj($oExcel)
    $sCellValue1 = _ExcelReadCell($oExcel, "E1")
    $sCellValue2 = _ExcelReadCell($oExcel, "E25")
    
    ; adjust for excel's change of format
    ;$sCellValue1 = ?
    ;$sCellValue2 = ?
    
    $Diff = _DateDiff("D", $sCellValue1 , $sCellValue2)
    $error = @error
    
    If $Diff >= 30 Then
        MsgBox(4096, "", "Hurry up please, you have only 1 month!       ")
        _ExcelBookClose($oExcel) ; And finally we close out
        Exit
    Else
        MsgBox(4096, $error, "You have " & $Diff & " days to comeplete this            " & @CRLF & $sCellValue1  & @CRLF & $sCellValue2, 5)
    EndIf

    Sleep(10000)
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for this Valuater, really nice code, but I already have a document named "mybook.xls" and there I must read and compare the current date and the date in cells E5:E25. Something like watcher mechanism, wich will give a message, if the date will come after 30 days. Sorry for uncertain information before. And I tryed to run this script, it makes an windows OS error "Send" or "Dont send" :party: .. And the format of the excel document is *.xls. :)

Edited by electrico

Share this post


Link to post
Share on other sites

Seems you can't understand how to implement the representation.

What I wrote is an example of what YOU can use. I had to open a "new" excel sheet to create the example, otherwise I would need you to send me YOUR work-sheet. Can't you see how that relates to opening and reading your stuff?

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0