Hi,
I am trying to create a macro whereby there is a beep whenever a certain function is hit/run, i.e. when a variable is hit then a beep of some sort sounds.
Any ideas on how this may be achieved?
Thanks
Sarah
Hi,
I am trying to create a macro whereby there is a beep whenever a certain function is hit/run, i.e. when a variable is hit then a beep of some sort sounds.
Any ideas on how this may be achieved?
Thanks
Sarah
Why?
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
It's actually for a friend of mine who is a primary teacher - she is teaching the kid's how to use excel, i.e. how to open and do basic math (eg 5x4) on it and was asking me if there was a way that it could be used to try and make using math and excel a bit more fun.... attantion span of kid's is not the longest!!!!
Hi,
I have found a bit of code in Google that will work for me... might keep the school kids interested for a little while!!
thanks for your help
Sarah
Hi,
I have attached the code if anyone is interested in the above function - it sends out several different types of beeps.
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, _ ByVal dwDuration As Long) As Long Sub TestBeep() Beep 500, 100 Application.Wait (Now + TimeSerial(0, 0, 1)) Beep 1000, 100 Application.Wait (Now + TimeSerial(0, 0, 1)) Beep 5000, 100 Application.Wait (Now + TimeSerial(0, 0, 1)) Beep 2000, 100 Application.Wait (Now + TimeSerial(0, 0, 1)) Beep 200, 100 End Sub
Sarah,
Thanks for sharing your findings.
Did you try using Beep by itself? I see it and some examples mentioned in Help.
And for the Lurkers, Sarah's code works for Windows but not Mac.
Cheers!
Ron
Windermere, FL
A bit more complex, but gives the possibility of different beeps in this thread
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
If you want to play a .wav file you might try this. Save your excel file and put the wave file in the same directory. Change the name of the wave file in the code to match what you want to play. Name in the code is LoadIt.WAV:
Option Explicit 'API Class to take care of playing the file Public Declare Function sndPlaySound32 Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub VBASound() 'Call Api to play LoadIt.wav witch is in the same folder as 'the active document! Call sndPlaySound32(ActiveWorkbook.Path & "\LoadIt.WAV", 0) End Sub
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Anyone who can set my beep up to play Chopsticks I'll help them finish a keg of Guinnes next time they're in Dublin :-)
Thanks for all the help
Sarah