use the gettickcount API

put this in a module

Code:
Public Declare Function GetTickCount Lib "kernel32" () As Long

put this in a command button, or whatever to fire it up

Code:
Private Sub Command1_Click()
Dim Count As Long
Dim Interval As Long
Dim EndTime As Long
Dim Temp As Long
Dim NextTick As Long
EndTime = (60 * 15) ' 15 minutes
Interval = 1000
    While Count < EndTime
        Temp = GetTickCount
        
        If NextTick < Temp Then 'Next tick reached
            NextTick = Temp + Interval 'Set next tick time
            
            Count = Count + 1 'Increase count
            
        End If
    
        DoEvents 'Handle windows messages (like KeyDown, MouseDown,...)
    Wend

    Call cmdRandom_Click
End Sub
lets say you wanted to run it 4 times.
then add a loop
like

Code:
Do Until NewVar = 4

'the code I gave you here
Loop
to change the time, all you have to do is
change the "EndTime" Variable.


Thanks to Fox, I downloaded his gettickcount demo, and I took alot of this code from him