multiple clicks

hello,
I have this in my VB6 form

Private Sub Command2_Click()
WebBrowser.Document.Forms("MailFormDelete").All("SelectAll").Click
WebBrowser.Document.Forms("MailFormDelete").submit
End Sub

what I would like to do is when I click on that button to keep clicking
every 5 minutes until I stop it. how can I do that?
apleloisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Add a Timer control to your Form:

Option Explicit

Private targetTime As Date

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 1000
    Command2.Caption = "Start"
End Sub

Private Sub Command2_Click()
    If Timer1.Enabled = False Then
        Call Click
        Command2.Caption = "Stop"
        Timer1.Enabled = True
    Else
        Timer1.Enabled = False
        Command2.Caption = "Start"
    End If
End Sub

Private Sub Click()
    WebBrowser.Document.Forms("MailFormDelete").All("SelectAll").Click
    WebBrowser.Document.Forms("MailFormDelete").submit
   
    targetTime = DateAdd("n", 5, Now())
End Sub

Private Sub Timer1_Timer()
    If Now >= targetTime Then
        Call Click
    End If
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
apleloisAuthor Commented:
wow your code works amazing but im sorry I meant 5 seconds
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Change this line:

    targetTime = DateAdd("n", 5, Now())

to:

    targetTime = DateAdd("s", 5, Now())
0
apleloisAuthor Commented:
thank you very much!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.