![]() |
Play and stop sound
I'm new to VBA. 1) Play sound as long as the criteria are satisifed The sound is played and looped as long as the criteria are satisfied However a user can stop this sound manually if desired. 2) Play sound as long as the message box is not dismissed A message box will pop up when the criteria are satisifed. The sound is played and looped at the same time. The sound will stop after the user has acknowledged the message by clicking on "ok" of the message box. 3) Stop sound How to create a code which can stop specific sounds, but not every sound which is playing? Thank you. PS: Here's the code (incomplete) for Q1-2: Function Alarm(Cell, Condition1, Condition2, ..., Message_text) 'incomplete Dim WAVFile As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Const SND_LOOP = &H8 On Error GoTo ProcessErr If Evaluate(Cell.Value & Condition) Then WAVFile = "C:\WINDOWS\Media\alert.wav" Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME Or SND_LOOP) MsgBox " {Message_text}" 'incomplete Alarm = True Exit Function End If ProcessErr: Alarm = False End Function -- Additional info about my computer: - Office XP - Windows XP Pro |
All times are GMT +1. The time now is 03:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com