例: Beep ステートメント

' While a user-specified interval (in seconds) elapses, beep
' and count the beeps. Then tell the user the number of beeps.
Dim howLong As Single, howManyBeeps As Integer
Function HowManyTimes (howLong As Single) As Integer
   Dim start As Single, finish As Single, counter As Integer  
   start! = Timer
   finish! = start! + howLong!
   While Timer < finish!
      Beep
      counter% = counter% + 1
   Wend
   HowManyTimes% = counter%
End Function
howLong! = CSng(InputBox _
   ("For your own sake, enter a small number."))
howManyBeeps% = HowManyTimes(howLong!)
MessageBox "Number of beeps:" & Str(howManyBeeps%)