# Visual Basic > Visual Basic FAQs >  Classic VB - How do I Pause my program?

## dglienna

Just like the Sleep command in Quick Basic, Visual Basic also lets you delay the execution of your code.  

You do it by calling an API (Application Programming Interface) which are functions that are built into the Windows operating system.

The one needed here is the Sleep() API, which will pause execution of your program for the specified number of milliseconds (1000ms=1 second).  In this example, the program is paused for 5 seconds when you click the button.  


VB Code:
Option Explicit
'This project needs a button
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
    'KPD-Team 1998
    'URL: [url]http://www.allapi.net/[/url]
    'E-Mail: [email]KPDTeam@Allapi.net[/email]
    Me.Caption = "Your system will sleep 5 sec."
    'Sleep for 5000 milliseconds
    Sleep 5000
    Beep
    Me.Caption = ""
End Sub
 Private Sub Form_Load()
    Me.Caption = ""
    Command1.Caption = "Sleep ..."
End Sub

A sample project is included below:

----------

