Sound


Posted by rcslocum on February 11, 2002 3:50 PM

How do you get sound enabled when filling in different cells. Thanks



Posted by Ivan F Moala on February 12, 2002 1:45 AM

If I understand you correctly then you wish to
play sound while a routine is running ??
If so then you need to do something like this;

The routine testdosomething should give you
an example of what to do...

Option Explicit
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_MEMORY = &H4
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10

Dim SndFile As String
Dim wFlags As Double
Dim x


Sub WAVStop()
Call WAVPlay(" ")
End Sub


Sub WAVLoop()
SndFile = "C:\WINDOWS\MEDIA\BasketBall\charge.wav"
If Dir(SndFile) = "" Then MsgBox "Error": End
wFlags = SND_ASYNC Or SND_LOOP
x = sndPlaySound(SndFile, wFlags)

End Sub

Sub testdosomething()
Dim x, y, z
WAVLoop
For x = 1 To 1000
For y = 1 To 50
Cells(x, y) = Rnd(x * y)
Next
Next
WAVStop
End Sub