+ Reply to Thread
Results 1 to 5 of 5

Alarm Clock or reinventing the wheel

  1. #1
    Registered User
    Join Date
    09-11-2006
    Posts
    56

    Alarm Clock or reinventing the wheel

    Hi All,
    The long and the short of it, at my office we share power with another company, every thursday at around 2:30 they change the power source from one to the other, this causes a power outage. My fax, Copier, Printer doesn't like this and I need to write a macro for my excel phone log that will popup a msgbox at about 2:25 every thursday and remind me to power down the Fax machine. I know this sounds rather trivial, but my day is extremely hectic, so I very rarely know what day it is much less what time it is. I have experimented with the IF function but I need something that will know what time it is without having to do a page recalculate.

    any help will really be excepted gratefully.

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    Do you always have the same excel workbook open everyday before 2.25?
    If you don't this will not work.
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,483
    Here's a site with an example

    http://www.xcelfiles.com/VBA_Clock.html

    and this one, seems neat

    http://www.karenware.com/powertools/ptalarm.asp

  4. #4
    Registered User
    Join Date
    09-11-2006
    Posts
    56
    Steve,
    Yes I use the same excel file every day.

    Dave,
    Thank you for those links they are way more than I need. I really only need something that will display a msgbox at 2:25 on thursdays something small and simple that doesn't require a lot of resources. I am going to pick that first clock program apart to see if I can find the code I need, I thank you for pointing me in the right general direction.
    "There are 10 kinds of people in the world, Those that understand binary, and those that don't."

  5. #5
    Registered User
    Join Date
    09-11-2006
    Posts
    56
    I wanted to thank you guys for responding to my question.
    I have come up with a rather small peice of code that seems to do the trick.

    Private Sub Workbook_Open()
    Dim MyWeekDay, MyDate
    MyDate = Now ' Assign a date.
    MyWeekDay = Weekday(MyDate)
    ' test to see if it is thursday.
    If MyWeekDay = 5 Then
    ' if it is thursday then execute the ontime code
    ' the ontime code is set for a specific time of the day 2:25 pm.
    Application.OnTime TimeValue("14:25:00"), "my_Procedure"
    Else
    'if it's not thursday then don't worry about this
    End If
    End Sub

    Sub my_Procedure()
    ' what to do when it is thursday at 2:25 pm.
    MsgBox "Time to Shut Down the Fax Machine", 0
    End Sub

    it took a lot of digging, thru the help files and a lot of test by stepping thru the code, but I think it is going to work like I need it to.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1