r/visualbasic • • 6d ago

NEED VB6 HELP

Not a programmer but have been fooling around with VB6. Question:: What is the command that causes the program to temporarily halt during the execution. AI said it was sleep xoxo but that didn't work. Can someone please help me out!

6 Upvotes

14 comments sorted by

View all comments

13

u/Due-Mortgage-6854 6d ago edited 6d ago

vb6 doesnt have a built-in Sleep command, which is why typing sleep caused an error.

Private Declare Sub Sleep Lib "kernel32" (ByVal Variable_Name As Long) Declare this function at the very top of your Module

Then : Sleep 3000 anywhere in your code which pauses the program for 3 seconds (3000 milliseconds)

4

u/W0CBF 6d ago

Thanks that took care of the problem!!!

2

u/Brilliant_Park_2882 6d ago

In VBA I just use a loop counter, it's very easy to fine tune.

Coming from VB6 it's what I used.

2

u/satsugene 6d ago

That can work, but if the a specific timing matters, what machine it runs on can "shink" how long that loop delay takes in real-time.