what is the code to delay then execute the next line

Recommended Answers

All 8 Replies

Why you always keep asking for code ?

Show some effort .

You can go for threads where u can give some pause..
m i right debasis?

i am done searching but no luck for me

All you luck is here.

why don't you use a time pause function to delay or a timer ????

how can i do that?

Try to go through the code.
Understand if you can.
Implement the way you want....

For a simple solution see below. I've used this for years:

1) Place a timer on a form.
Name it tmrWaiting
Set its interval property to 1000. (That’s 1 second)

2) Declare a form level Boolean variable. E.G. Dim waiting as Boolean

3) In the timer event. Just type:
waiting = false

4) On the line where the delay must be, type:

waiting = True
Print "Hello"
Do While waiting
DoEvents
Loop
Print "Bye"

Here’s an example. Just tyhe same really: ... Simples. Good luck. Paul

Option Explicit

Dim waiting As Boolean

Private Sub Form_Activate()
waiting = True
Print "Hello"
Do While waiting
DoEvents
Loop
Print "Bye"
End Sub

Private Sub tmwWaiting_Timer()
waiting = False
End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.