Beep Statement

Example3C7IDW>Low

Sounds a tone through the computer's speaker.

Syntax

Beep

Remarks

The frequency and duration of the beep depends on hardware, which may vary among computers.


Beep Statement Example

The example uses Beep to sound a tone in the computer speaker if Answer is less than 1 or greater than 3.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

 

Sub Form_Click ()

   Dim Answer, Msg                             ' Declare variables.

   Do

      Answer = InputBox("Enter a value from 1 to 3.")

      If Answer >= 1 And Answer <= 3 Then      ' Check range.

         Exit Do                               ' Exit Do...Loop.

      Else

         Beep                                  ' Beep if not in range.

      End If

   Loop

   MsgBox "You entered a value in the proper range."

End Sub