Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you declare RandCheer as Integer, it will always be Zero or 1. You
haven't accounted for .9 to 1, so there should be deafening silence half the time and the rest of the time, QAcrowdcheer.wav. Anyway, declare it as single. -- Regards, Tom Ogilvy wrote in message oups.com... Thanks KD! I input the code but it appears that when an answer is input into the cell, only 1 of two sounds are being played, "C:\Windows\Media\QAcrowdcheer.wav" and "C:\Windows\Media\QAaaaah.wav" Do you know why this is? Did I type this correctly? Public Function QAcheer() As String Dim RandCheer As Integer Randomize RandCheer = Rnd() 'gives the decimal number between 0-1 Select Case RandCheer Case 0 To 0.1 PlaySoundFile "C:\Windows\Media\QAcrowdcheer.wav" Case 0.1 To 0.2 PlaySoundFile "C:\Windows\Media\QAkidsapplause.wav" Case 0.2 To 0.3 PlaySoundFile "C:\Windows\Media\QAgoteam.wav" Case 0.3 To 0.4 PlaySoundFile "C:\Windows\Media\QAcrowdclap2.wav" Case 0.4 To 0.5 PlaySoundFile "C:\Windows\Media\QAcrowdclap.wav" Case 0.5 To 0.6 PlaySoundFile "C:\Windows\Media\QAaaaah.wav" Case 0.6 To 0.7 PlaySoundFile "C:\Windows\Media\QAcrowdcheer2.wav" Case 0.7 To 0.8 PlaySoundFile "C:\Windows\Media\QAwow.wav" Case 0.8 To 0.9 PlaySoundFile "C:\Windows\Media\QAcrowdcheer.wav" End Select QAcheer = vbNullString End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
what is this called? : < | Excel Worksheet Functions | |||
Called subs versus functions | Excel Programming | |||
Frustrated with VBA so-called help | Excel Programming | |||
How can a UDF be called from a formula? | Excel Worksheet Functions | |||
XLA function called twice | Excel Programming |