Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to use code to insert a WAV file.

Status
Not open for further replies.

mondo

IS-IT--Management
Feb 22, 2001
2
US
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)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top