Jump to content

Run code in between certain month/days.


Recommended Posts

Hi, i need the code to run only in between two month/day's specified.

The snippet below works perfectly but only if the Month/Day is past the specified Month/Day.

$Date = @MON & "/" & @MDAY


    If $Date > "12/22" Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf

This is what i have tried but is wrong.

$Date = @MON & "/" & @MDAY


    If $Date > "12/22" & $Date < "12/24" Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf

So how will i do this? Thanks for reading.

Edited by anzacfalcon
Link to comment
Share on other sites

Here is your code. You cannot "test" strings for bigger or smaller, you can do that with values !!!

$Date = @MON & "/" & @MDAY

If @MON = 12 then
    If @MDAY > 22 And @MDAY < 24 Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf
EndIf

Cram...

EDIT: MISSTYPO

Edited by cramaboule
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...