HDI: Play .WAV clip in Excel?

M

Matthew =}

Hiya!

I would like MySheet to play "Yes.wav" for
MyCondition=True and "No.wav" when MyCondition=False.
Any tips or reference to appropriate KB articles
appreciated.

Y'all rock,

Matthew =}
 
B

Bob Phillips

You need VBA

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
(ByVal lpszName As String, _
hModule As Long, _
ByVal dwFlags As Long) As Long

Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function

call it like

PlayWavFile ("C:\Windows\Media\Microsoft Office 2000\Chimes.wav")
 
M

Matthew =}

Dear Bob,

Coolness. I dropped the VB approach when the Excel VBA
help on 'media' + 'clip' returned 'Help on the Play
method' - but said that method had been removed from
Excel. So, thank you very much!

Hurricanes & Earthquakes,

Matthew

=}

************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top