Sunday, August 13, 2006

RatRace

' This code really works! Copy and paste into VB
' The truth - Rat race - V1.0 - Vince Natteri - http://techotek.com - Copyright 2006

' This code runs constantly


Sub RatRace()
Dim YourAge As Integer
Dim Salary As Double 'Actually, integer will do but I am just flattering myself

'Get the age
YourAge = InputBox("What the heck is your age?", "Your age again:")

'What the heck is his age
If Not IsNumeric(YourAge) Then
    MsgBox
"You can't remember your age and have succombed to the rat race."
    Exit Sub
End If


'Start the rat race!
While (YourAge < 65 )
    'WeekDay returns 2 for Mondays and 7 for Saturdays...
    If Weekday(Format(Now, "dd-mmm-yyyy")) >= 2 And Weekday(Format(Now, "dd-mmm-yyyy")) <= 7 Then
        MsgBox
"You are: " & YourAge & ". Now go to work, please your boss and draw an income and pay the bills"
    Else
        MsgBox
"Relax, it's the only day in the week you can do this"
    End If
    'Is he dead?
    If (MsgBox("Are you dead yet?", vbYesNo) = vbNo) Then
        'Increase age by one if it's been an year
        If (MsgBox("Is it your birthday yet?", vbYesNo) = vbYes) Then YourAge = YourAge + 1
    Else
        MsgBox
"Sorry to hear that. Hope you've worked well and made some large corporation more money."
        Exit Sub
    End If
Wend


'Over!
MsgBox "Congratulations! You've been working all your life to pay bills! Hope you enjoyed being part of the rat race! Good bye!"
End Sub

No comments: