Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 12-10-2006, 08:55 PM   #1 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


Question VB Code Help Set up Hourly Event

I would like some help with setting up a message box to come up every day every hour on the hour, it needs to be a reminder for a worker to do a check, it needs to happen exactly on the hour eg. 12am 1am 2am etc. There are two workers who do this in rotating shifts over the twenty four hour period.Is there anyone out there who could help me please!!!!,
Iceman 26
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 12-11-2006, 02:33 AM   #2 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,470
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
Hi and welcome to TSF.

This should do what you want. This first part goes in ThisWorkbook Module.
Code:
Private Sub Workbook_Open()
StartTheClock
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopTheClock
End Sub
And the next bit goes in a normal Module.
Code:
Public ScheduleTime As Double


Sub StartTheClock()
Dim nextHour As Integer

nextHour = Hour(Time) + 1
ScheduleTime = TimeValue(nextHour & ":00:00")
Application.OnTime ScheduleTime, "PopMessage"
End Sub

Sub PopMessage()
MsgBox "Wake up! - It's time to do that check!"
End Sub

Sub StopTheClock()
On Error Resume Next
Application.OnTime EarliestTime:=ScheduleTime, Procedure:="StartTheClock", schedule:=False
End Sub
Remember to change the message to one that suits you.

Post back if you have any problems.
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner

Last edited by Glaswegian; 12-11-2006 at 02:38 AM.
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-11-2006, 12:40 PM   #3 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


VB Code Help Set up Hourly Event

I will try that thank you very much Glaswegian, Iceman 26
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-11-2006, 02:39 PM   #4 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


Thumbs Up Thanks Very Much Works Perfectly One More Question

Thanks very much Glaswegian I have one more question you may be able to help me with, In that same sheet I would like to set up a reminder that will come up on the half hour if the log has not been done.
Thanks very much again Iceman26
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-11-2006, 03:39 PM   #5 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,470
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
You are welcome.

Can you give me a bit more info about this other reminder. Is this separate from the hourly message? Is it, in effect, changing the hourly message to a half hourly message or do you mean something different? Is the new reminder based on an entry in a sheet?

The more detail you give me, the easier it will be for me to provide you with a solution.
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-11-2006, 04:19 PM   #6 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


Cool New Reminder

This reminder is based on an entry in the the sheet, the sheet has a drop down arrow box that is in regards to the hourly check that has the choice of heard or error, i need the message box to come up on the half hour only if these have not been filled, Thank you again for your patience and your help
it is very much appreciated, Iceman26
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-12-2006, 03:03 PM   #7 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,470
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
OK, so you need a message to appear every half hour if the dropdown box has not been filled - yes? What are the possible values for the dropdown box? Does it normally show a blank and then a value after completion? What is the cell address of the dropdown and sheet name?
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-12-2006, 03:31 PM   #8 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


New Reminder

Yes to the first question, The possible variables are "Heard" or "Error", it normally shows blank then a value after completion, the cell address of the dropdown and sheet name are "C:6 to G:29" inclusive "Sheet1", The cells C:6 & G:6 represent the check for 01:00:00 UTC, C:7 & G:7 for 02:00:00 UTC etc.
& is there a way of making excel maximise when the message box comes up!!!
I am very very grateful for your help and your time, Thanks Iceman26
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-12-2006, 04:27 PM   #9 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,470
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
Hi Iceman26

The easy bit - to maximise Excel, add this line just before your message box line
Code:
Application.WindowState = xlMaximized
I'll have a look at the other question tomorrow - it's a bit late here now and I really need to get some sleep!
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-13-2006, 01:14 PM   #10 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,470
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
Hi again

Try this:

These first declarations go at the top of the Module, i.e, before any subs
Code:
Public RunWhen As Double
Public Const cRunIntervalMins = 30    ' thirty minutes
Public Const cRunWhat = "HalfHourWarning"
Then the next 2 routines go in any normal Module
Code:
Sub StartTimer()

RunWhen = Now + TimeSerial(0, cRunIntervalMins, 0)
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
     schedule:=True
End Sub


Sub HalfHourWarning()
If Sheets("Sheet1").Range("B1").Value = "" Then
    MsgBox "Don't forget to check it...", vbInformation, "Check it..."
End If
StartTimer
End Sub
This simply an adaptation of Chip Pearson's method for running procedures after a specific interval. The first sub runs the second sub, and the last line in the second, 'StartTimer' resets the first sub to run again, and so on.

Hope this works for you.
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 12-13-2006, 01:54 PM   #11 (permalink)
Registered User
 
Join Date: Dec 2006
Location: Braidwood NSW Australia
Posts: 6
OS: 2000


Thanks Very Much I will see how it goes!!!!
Iceman26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 01:02 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85