Playing The Sound Based On A Cell’s Value

Nisan 22, 2016 Yorum bırakın

The created macro plays a sound according to value of changed cell in Column C.

New value can be entered to cells in Column C with combobox. In this macro, we have used 3 different sound (chimes.wav ,chord.wav ,tada.wav) .

playing a sound based on a cell's value

Template can be downloaded here

Playing A Sound File If A Condition Is Met

Nisan 20, 2016 Yorum bırakın

Excel Sound Alert

This macro plays a .wav file (C:\Windows\Media\chord.wav) when a duplicate value is entered in Column A.
Also msgbox is opened and the msgbox  shows repeated values’ row numbers.Used code to play the sound :

#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

excel sound alert , play sound

Download example file

Takip Et

Her yeni yazı için posta kutunuza gönderim alın.

Diğer 54 takipçiye katılın