LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Sound repeats unending until closing workbook

On Sheet 1 I have two shapes with

Sub A_1_up() assigned to one.
Sub A_1_Down() assigned to the other.

If I click either shape it plays the sound in either F1 or G1 but it goes into a continuous loop and plays the sound repeatedly until I close the workbook.
I have copied the sound portions of code from a workbook that operates just fine, playing the sound just once albeit from a worksheet change event macro. That is, there are several sounds listed in a drop down and when a sound is selected it plays that sound once only.

I am lost as to why the repeated playing. The code below is the ONLY code in the entire workbook.

Thanks,
Howard

In a standard module I have this:

Option Explicit

Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40

Public Sub SoundPlayAsyncLoop(Sound As String)
sndPlaySound Sound, SND_ASYNC Or SND_LOOP
End Sub

Public Sub SoundPlayAsyncOnce(Sound As String)
sndPlaySound Sound, SND_ASYNC
End Sub


In the Sheet1 module I have this:

Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Status As Boolean

Sub A_1_up()

Range("A1").Value = Range("A1").Value + 1
SoundPlayAsyncLoop Sheets("Sheet1").Range("F1").Text

End Sub

Sub A_1_Down()

Range("A1").Value = Range("A1").Value - 1
SoundPlayAsyncLoop Sheets("Sheet1").Range("G1").Text

End Sub

On the sheet I have this:

In F1 C:\Windows\Media\ringout.wav
In G1 C:\Windows\Media\Speech Off.wav
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
play sound when closing xcel 2007 Pirgnori Excel Discussion (Misc queries) 1 December 28th 09 09:21 PM
copy and paste VBA repeats and repeats Marilyn Excel Discussion (Misc queries) 4 June 7th 09 03:49 PM
Closing a workbook from a macro doesn't close the workbook Dave P Excel Programming 2 July 10th 07 06:16 PM
play sound when opening workbook Alen32 Excel Programming 4 April 21st 05 12:22 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"