Sunday, April 17, 2016

Playing The Sounds In Excel

          In this example ,we have played the sounds in directory with macros that we assigned to shapes .For this process we have used ExecuteExcel4Macro Method. For example :

Application.ExecuteExcel4Macro "SOUND.PLAY(,""" & ActiveWorkbook.Path & "\mi.wav"")"

In the example on second page, we have used Function sndPlaySound32 to play the sounds.  For example :

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

Sub Do_2()
    Call sndPlaySound32(ThisWorkbook.Path & "\do.wav", 0)
End Sub

No comments:

Post a Comment