Running Macros At Set Times

  • Thread starter Thread starter ADE2
  • Start date Start date
A

ADE2

Hi

I want to build ONE large macro to run a sequence of macros alread
built,i would like these subroutines to run after a delay of 4 second
after the completion of the prior subroutine so as to not overload m
computer.

There is no set time that i will want to run the ONE single macro,
would like it to be flexible,so i don't know if using the Now(
function somewhere within the code would be the best idea and making i
run the subroutines at NOW() plus 4 seconds.

So when i hit the single macro button on the toolbar i would like su
macro one to run straight away,=NOW(),then sub macro two, four second
after pressing the button,then sub macro three to run four second
later(8 seconds after pressing the toolbar button),etc.

Here are two of the numerous macro subroutines that i want to buil
into the single new macro:-

Sub DAILYSOLVER()
'
' DAILYSOLVER Macro
' Macro recorded 25/01/2004 by ADE
'

'
SolverReset
SolverLoad LoadArea:="$F$14:$F$17"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001
AssumeLinear _
:=False, StepThru:=False, Estimates:=1, Derivatives:=1
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001
AssumeNonNeg:=False
SolverOk SetCell:="$F$21", MaxMinVal:=1, ValueOf:="0"
ByChange:="$B$21"
SolverSolve UserFinish:=True
End Sub


Sub WEEKLYSOLVER()
'
' WEEKLYSOLVER Macro
' Macro recorded 25/01/2004 by ADE
'

'
SolverReset
SolverLoad LoadArea:="$F$46:$F$49"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001
AssumeLinear _
:=False, StepThru:=False, Estimates:=1, Derivatives:=1
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001
AssumeNonNeg:=False
SolverOk SetCell:="$F$54", MaxMinVal:=1, ValueOf:="0"
ByChange:="$B$54"
SolverSolve UserFinish:=True
End Sub

Thanks for any help you can give

Ad
 
If you a re just trying to run the macros sequentially you can call the
from a master sub ie.

Sub RunAll

DAILYSOLVER

WEEKLYSOLVER

end sub

This will run each sub in sequence.

Dunca
 
Probably just as easy (better?) to throw up a time msgbox for 4 seconds

Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 4 ' 4 secs
Select Case WSH.Popup("Please wait", cTime, "Hint", vbOKCancel)
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top