Beep

Syntax

Beep [ErrorType]

Remarks

Causes the computer's speaker to produce a sound. A typical use of Beep is to signal the end of a long process or to indicate that an error has occurred.

In Windows, Beep produces the sound associated with the specified error type. You associate sounds with error types using the Sound option in Control Panel. If there isn't a sound device installed, Beep produces the default sound through the computer speaker, regardless of the value of ErrorType.

On the Macintosh, Beep produces the sound selected in the Sound control panel, regardless of the value of ErrorType.

Argument

Explanation

ErrorType

In Windows, the type of sound, as specified in Control Panel.

-1 Default sound from the computer speaker

0 (zero) or omitted Default sound

16 Critical stop

32 Question

48 Exclamation

64 Asterisk

If there is no sound associated with the specified error type, Word produces the default sound.


Note

In Windows 3.x, a beep will not sound if the [Windows] section of WIN.INI includes the line Beep = No. In Windows NT, a beep will not sound if the Beep setting has the value "No" in the HKEY_CURRENT_USER\Control Panel\Sound key.

Examples

This example produces a beep immediately before displaying an input box:


Beep
name$ = InputBox$("The macro has finished running. " + \
                        "Save document as:")

The following example makes the computer beep three times. The second For¼Next loop nested within the first one provides a delay between beeps. In effect, the delay loop makes Word count to a thousand before producing the next beep. Without the delay loop, Word would produce beeps so quickly that they would sound like a single, continuous beep. You can vary the delay between beeps by increasing or decreasing the end value of the second For¼Next loop. For example, changing the end value to 5000 would increase the delay between beeps; changing it to 100 would decrease the delay.


Sub BeepThreeTimes
    For x = 1 to 3
        Beep
        For timer = 1 To 1000    'Delay loop between beeps
        Next timer
    Next x
End Sub