Word
Play sound file with VBA
Ease of Use
Easy
Version tested with
2000, 2003
Submitted by:
MOS MASTER
Description:
Programmatically play sound file. (*wav)
Discussion:
You may need a way to give feedback or direction to users but you don?t want to use pop-ups! Well you can use sound feedback instead.
Code:
instructions for use
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 which is in the same folder as 'the active document! Call sndPlaySound32(ActiveDocument.Path & "\LoadIt.WAV", 0) End Sub
How to use:
Test the code:
Sample File:
Play Sound.zip 54.75KB
Approved by mdmackillop
This entry has been viewed 106 times.
Please read our Legal Information and Privacy Policy Copyright @2004 - 2020 VBA Express