View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default User Form pop up with a beep?

Beep works for me - do you have your speakers turned down./off, headphones
plugged in.

Is the messagebox audible.

Here is a way to do it with the API (but the speakers have to be on).

In NT/XP/2003, you can control the internal speaker (which makes the beep)

Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, _
ByVal dwDuration As Long) As Long


Sub Beep1()
Dim num As Single
Dim num1 As Long
Dim numLoops As Single
num = 10
NumSeconds = 4 '<== duration
numLoops = (NumSeconds * num * 2) / 2
If numLoops < 1 Then
numLoops = 1
End If
num1 = 1000 / (num * 2)


For i = 1 To numLoops
'DoEvents
Beep 500, num1
'DoEvents
Beep 10000, num1
'DoEvents
Next
End Sub


The first argument is the frequency. You can change the 10000 (you can't
hear that) to 1000 to get a different affect for example.


--
Regards,
Tom Ogilvy



"Don Wiss" wrote in message
...
On Sun, 10 Dec 2006, Gary Keramidas <GKeramidasATmsn.com wrote:

does this work for you

Private Sub UserForm_Initialize()
Beep
End Sub


Nope.

Don <www.donwiss.com (e-mail link at home page bottom).