start my private sub every 2 minutes - i'm on vb6

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

start my private sub every 2 minutes - i'm on vb6

Post by sal21 »

I need to strta my private sub TEST, at every 2 minutes...
How to?

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: start my private sub every 2 minutes - i'm on vb6

Post by HansV »

Place a Timer control on a form.
Set its Timer Interval property to 120000 (it is in milliseconds: 2 minutes = 120 seconds = 120000 milliseconds).
Set the Enabled property to True.
Call your procedure in the Timer Tick event (you may have to make TEST public)
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4440
Joined: 26 Apr 2010, 17:36

Re: start my private sub every 2 minutes - i'm on vb6

Post by sal21 »

HansV wrote:
27 May 2024, 14:41
Place a Timer control on a form.
Set its Timer Interval property to 120000 (it is in milliseconds: 2 minutes = 120 seconds = 120000 milliseconds).
Set the Enabled property to True.
Call your procedure in the Timer Tick event (you may have to make TEST public)
ERROR in

Me.Timer2.Interval = 120000

i have set this property in Load event

Me.Timer2.Enabled = True
Me.Timer2.Interval = 120000


googoling...
timer interval accept mx value 65535

in other case, also in googoling:

Private Secondi As Long

Private Sub Timer1_Timer()
Secondi = Secondi + 1
If Secondi=600 Then
' Sono passati 10 minuti, esegui qui la tua azione

' ...

'Resetta il timer
Secondi = 0
End If
End Sub

wath you hink about?
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78991
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: start my private sub every 2 minutes - i'm on vb6

Post by HansV »

Have you tested it? If so, does it work?
Best wishes,
Hans