ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Excel - Generating Sounds (https://www.excelbanter.com/excel-programming/310449-vba-excel-generating-sounds.html)

ajliaks[_41_]

VBA Excel - Generating Sounds
 

Hi all,

Could anybody tell me how to generate a sound?

I need to play a sound every time I finish running a macro.

Thanks in advance,
Aldo

--
ajliak
-----------------------------------------------------------------------
ajliaks's Profile: http://www.excelforum.com/member.php...nfo&userid=819
View this thread: http://www.excelforum.com/showthread.php?threadid=26136


Frank Kabel

VBA Excel - Generating Sounds
 
Hi
see:
http://j-walk.com/ss/excel/tips/tip59.htm

--
Regards
Frank Kabel
Frankfurt, Germany


ajliaks wrote:
Hi all,

Could anybody tell me how to generate a sound?

I need to play a sound every time I finish running a macro.

Thanks in advance,
Aldo.


ste mac

VBA Excel - Generating Sounds
 
Hi ajliaks, I use this code, just put the sound file in the same folder/
directory and call it by the macro and it should work...


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

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

Sub playmywavfile()
WAVFile = "thewavyouwanttoplay.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

hope this helps...

seeya ste


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com