ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OnTime events (https://www.excelbanter.com/excel-programming/305877-ontime-events.html)

bambam77[_7_]

OnTime events
 
I am having trouble getting an Application.OnTime event to work. I a
typing in the code correctly, but when the time comes around, nothin
happens. I am using a test example from a VBA guide book, so I know th
code is written correctly. I just don't know why nothing happens. Ca
anyone help me

--
Message posted from http://www.ExcelForum.com


Chip Pearson

OnTime events
 
It would be helpful if you posted the code you are using.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"bambam77 " wrote in
message ...
I am having trouble getting an Application.OnTime event to

work. I am
typing in the code correctly, but when the time comes around,

nothing
happens. I am using a test example from a VBA guide book, so I

know the
code is written correctly. I just don't know why nothing

happens. Can
anyone help me.


---
Message posted from http://www.ExcelForum.com/




bambam77[_9_]

OnTime events
 
OOps Sorry

Sub SetAlarm()
Application.OnTime 0.625, "DisplayAlarm"
End Sub

Sub DisplayAlarm()
Beep
MsgBox "Wake up. It's time for break!"
End Sub

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

OnTime events
 
dir you run the subroutine SetAlarm?

You ran it and nothing happened at 3 PM.

You can test with a command like
Application.OnTime now + TimeValue("00:00:15"), "DisplayAlarm"

to have it run in 15 seconds.

--
Regards,
Tmo Ogilvy



"bambam77 " wrote in message
...
OOps Sorry

Sub SetAlarm()
Application.OnTime 0.625, "DisplayAlarm"
End Sub

Sub DisplayAlarm()
Beep
MsgBox "Wake up. It's time for break!"
End Sub.


---
Message posted from http://www.ExcelForum.com/




bambam77[_12_]

OnTime events
 
Ys, I ran the SetAlarm routine and nothing happened. i will try the code
you gave to try a test.


Thanks


---
Message posted from http://www.ExcelForum.com/


bambam77[_13_]

OnTime events
 
Maybe I didn't run the Macro. I thought I didn't need to assign it to
button or anything to make it work. I thought it just work
automatically let me know if I'm wrong

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

OnTime events
 
You have to explicitly run the macro that schedules ontime to run. Ontime
then runs the scheduled macro at the scheduled time.

See Chip Pearson's page on this

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy




"bambam77 " wrote in message
...
Maybe I didn't run the Macro. I thought I didn't need to assign it to a
button or anything to make it work. I thought it just works
automatically let me know if I'm wrong.


---
Message posted from http://www.ExcelForum.com/




bambam77[_14_]

OnTime events
 
Thanks, the page helped a lot

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com