ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form pop up with a beep? (https://www.excelbanter.com/excel-programming/379150-user-form-pop-up-beep.html)

Don Wiss

User Form pop up with a beep?
 
I'd like a User Form to make the same beep as a MsgBox makes when it pops
up. I tried the word Beep in front of my User Form show, but I got no
sound.

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

Gary Keramidas

User Form pop up with a beep?
 
does this work for you

Private Sub UserForm_Initialize()
Beep
End Sub

--


Gary


"Don Wiss" wrote in message
...
I'd like a User Form to make the same beep as a MsgBox makes when it pops
up. I tried the word Beep in front of my User Form show, but I got no
sound.

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




Don Wiss

User Form pop up with a beep?
 
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).

Gary Keramidas

User Form pop up with a beep?
 
you have events turned off or something? make a new form and just add these
lines of code to it, it should work.

--


Gary


"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).




Tom Ogilvy

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).





All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com