A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Links and Linking
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Screen flicker



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2004, 07:16 AM
Jesse
external usenet poster
 
Posts: n/a
Default Screen flicker

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.





  #2  
Old May 18th, 2004, 07:35 AM
Bill Manville
external usenet poster
 
Posts: n/a
Default Screen flicker

Jesse wrote:
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 NextTime0 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

  #3  
Old May 22nd, 2004, 01:56 PM
Jesse
external usenet poster
 
Posts: n/a
Default Screen flicker

Thanks Bill- the first solution worked perfectly.

Jesse.

Jesse wrote:
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 NextTime0 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



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.