Results 1 to 4 of 4

Play sound ONCE when cell value changes

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Play sound ONCE when cell value changes

    The following macro is linked to an IF statement in cell W59. I would like the macro to play only ONCE when the IF statement is true. The macro will continuously play the sound if the reference value in cell 059 changes. Is there a way to modify this method so that the macro only plays a sound ONCE?

    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
    
    Function SoundMe() As String
        Call PlaySound("c:\windows\media\tada.wav", _
          0, SND_ASYNC Or SND_FILENAME)
        SoundMe = ""
    End Function
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1