Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gum Gum is offline
external usenet poster
 
Posts: 30
Default constrain the no of sub procedure executions per second

I need to restrict the number of executions per second for two sub
procedures. When sum total of sub procedure executions per second is more
than a user defined number per second (e.g., five (5) per second), I need
the threads running the procedure to stop for a user defined period (e.g.,
one (1) second), while other processes can continue.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default constrain the no of sub procedure executions per second

If avgExec userExec Then
waitTime = Now + TimeValue("00:00:05")
Do Until Now waitTime
DoEvents
Loop
End If

DoEvents will pause execution and allow other processes to execute.

"Gum" wrote:

I need to restrict the number of executions per second for two sub
procedures. When sum total of sub procedure executions per second is more
than a user defined number per second (e.g., five (5) per second), I need
the threads running the procedure to stop for a user defined period (e.g.,
one (1) second), while other processes can continue.

  #3   Report Post  
Posted to microsoft.public.excel.programming
Gum Gum is offline
external usenet poster
 
Posts: 30
Default constrain the no of sub procedure executions per second

Thanks for your response. The avgExec variable, the number of executions per
sec, would be the total of the number of executions of two sub procedures per
second.

I need to find out how to get compute the 'avgExec' variable so that I can
use your procedure below to stop the execution when avgExecuserExec is true.

"AndyM" wrote:

If avgExec userExec Then
waitTime = Now + TimeValue("00:00:05")
Do Until Now waitTime
DoEvents
Loop
End If

DoEvents will pause execution and allow other processes to execute.

"Gum" wrote:

I need to restrict the number of executions per second for two sub
procedures. When sum total of sub procedure executions per second is more
than a user defined number per second (e.g., five (5) per second), I need
the threads running the procedure to stop for a user defined period (e.g.,
one (1) second), while other processes can continue.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Gum Gum is offline
external usenet poster
 
Posts: 30
Default constrain the no of sub procedure executions per second

Perhaps, I should explain further:

I have 2 sub procedures that are run concurrently:
Sub FirstSub()
if firstCondition=True then
....

wait 0.1 sec
secondSub
end if
end sub

sub SecondSub()
if secondcondition=True Then
....
wait 0.1 sec
FirstSub

end Sub
When the instances where condition1 and condition2 occur say 1 second apart
the program yields favourable results. However, if they run without
interruption, they would together take 0.2 secs to execute and this leads to
an error. I do not want to bypass the error as the condition is not
desirable. The Wait 0.1 sec time is just sufficient for each sub procedure
to compete its task before going to the other sub.





"Gum" wrote:

Thanks for your response. The avgExec variable, the number of executions per
sec, would be the total of the number of executions of two sub procedures per
second.

I need to find out how to get compute the 'avgExec' variable so that I can
use your procedure below to stop the execution when avgExecuserExec is true.

"AndyM" wrote:

If avgExec userExec Then
waitTime = Now + TimeValue("00:00:05")
Do Until Now waitTime
DoEvents
Loop
End If

DoEvents will pause execution and allow other processes to execute.

"Gum" wrote:

I need to restrict the number of executions per second for two sub
procedures. When sum total of sub procedure executions per second is more
than a user defined number per second (e.g., five (5) per second), I need
the threads running the procedure to stop for a user defined period (e.g.,
one (1) second), while other processes can continue.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continual Executions wutzke Excel Programming 1 March 22nd 08 01:28 PM
executions per second N+ Excel Programming 2 March 6th 08 06:07 PM
Hide macros executions Angeliki Excel Programming 1 November 26th 03 07:46 AM
Hide macros executions Angeliki Excel Programming 1 November 25th 03 04:31 PM
Hide macros executions Angeliki Excel Programming 1 November 25th 03 03:59 PM


All times are GMT +1. The time now is 08:43 PM.

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

About Us

"It's about Microsoft Excel"