I've been trying to create a form that will play a WAV file when a button is pressed but my knowledge of VBA is very limted and I have had no success yet. Could anybody tell me how to do this.
Sub PlaySound(WAVFile As String)
Dim CmdStr As String
StopAVI 'Stop any playing AVI
StopSound 'Stop any playing .WAV
'Open the waveaudio device with WAVFile
CmdStr = ("open " & WAVFile & " type waveaudio alias TheWAV"
vid = AVIFunction(CmdStr, 0&, 0, 0)
'Play WAVFile
vid = AVIFunction("play TheWAV", 0&, 0, 0)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.