Do a search in this form about using the timer control in this forum, it's pretty easy once you get the hang of it and you just have to add code to the timer event to close your form.
I have set a timer, but the form can't close.
here is my code, but didn't work. can't close the form if nobody click on the OK button. I need the form close when onbody clik any buttons on the message.
Private Sub Form_load()
Timer2.Enabled = True
If MsgBox("Close the form if you are through! ", vbOKCancel, "Title" = vbYes Then
Unload Me
Else
Exit Sub
End If
End Sub
Private Sub Timer2_Timer()
CloseTime = CloseTime + Timer2.Interval
If (CloseTime > 1000) Then
Unload Me
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.