Home > Excel Tutorial > Playing The Sound In Excel Worksheet & On Userform

Playing The Sound In Excel Worksheet & On Userform

 

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

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

In the example on second worksheet, we have used Function sndPlaySound32.  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

The example can be viewed on worksheets and on the UserForm.

excel play sound

Example file can be downloaded here

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: