Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Links / May 2004

Tip: Looking for answers? Try searching our database.

Screen flicker

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesse - 18 May 2004 07:16 GMT
Greets all,

   I created a time-clock sheet at work where excel logs the times that
employees clock in or out.  This part works without a hitch.

   However, my supervisor wants the program to also track the amount of
time that the employee has been on break at any given moment.

   What I did was set up a VBA script to do this, but this causes the
screen and cursor to flicker continuously.  Is there any way to stop this?

   With the script, I am using a Do...DoEvents...Loop with the time being
updated before the DoEvents command.

Example:

Current time  6:17 am

Employee-1
Start time   6:02 am
Finish time 6:32 am
Duration   15:23

   The duration is in minutes and seconds, updated continuously.

Thanks,

Jesse.
Bill Manville - 18 May 2004 07:35 GMT
> With the script, I am using a Do...DoEvents...Loop with the time being
> updated before the DoEvents command.

If he doesn't need to break into the macro, make it run say every minute
by putting
 Application.Wait Now+TimeValue("00:01:00")
in the loop.

If he needs to break in, you can use Application.OnTime to run your
update macro once but it's a bit more complicated:

Dim NextTime As Date  ' at top of standard module

Sub Auto_Open()      
StartUpdate
End Sub

Sub Auto_Close()
StopUpdate
End Sub

Sub StartUpdate()
NextTime = Now + TimeValue("00:01:00")
Application.OnTime Now, "DoUpdate"
End Sub

Sub StopUpdate()
If NextTime<>0 Then
 Application.OnTime Now, "DoUpdate",Schedule:=False  
 NextTime = 0
End If
End Sub

Sub DoUpdate()
' your code to do one update of the screen
StartUpdate
End Sub

Hope this helps

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup
Jesse - 22 May 2004 13:56 GMT
Thanks Bill- the first solution worked perfectly.

Jesse.

> > With the script, I am using a Do...DoEvents...Loop with the time being
> > updated before the DoEvents command.
[quoted text clipped - 39 lines]
> MVP - Microsoft Excel, Oxford, England
> No email replies please - respond to newsgroup
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.