Sound Alert In Excel

Playing A Sound File If A Condition Is Met

        The created macro plays a .wav file (C:\Windows\Media\chord.wav) when a duplicate value is entered in Column A. 
Later a msgbox is opened and the msgbox  shows repeated values' row numbers.
Our code to play .wav file :

#If Win64 Then
'Code is running in 64-bit Office
Private Declare PtrSafe Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
#Else
'Code is running in 32-bit Office
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
#End If

....

 #If Win64 Then
sndPlaySound "C:\Windows\Media\chord.wav", 0&
#Else
sndPlaySound32 "C:\Windows\Media\chord.wav", 0&
#End If


No comments:

Post a Comment