Try this:
To play a random sound:- In your Sound() macro, Define a String array, like sFilePath(1 to 10) and store the full file path with names & extension for the 10 short sound clips you have.
- Now generate a random number between 1 and 10 use RND Function
- E.g. Int ((10 - 1 + 1) * Rnd + 1) would return a random number between 1 and 10
- Store this Random Number to an integer variable, say iInt
- and now you may call the specific array element, like sFilePath(iInt) to play a random sound
Now for the 2nd part (playing it after every X Seconds or on Cursor reaching a cell- For cursor reaching a cell, call the Sound Macro from the Worksheet_SelectionChange event when the Target intersects with the desired cell
- For playing every "x" seconds (say 30 seconds), at the end of your Sound Macro, call another Macro, say Repeat() (see code below)
- Now repeat will call Sound() after 30 seconds; and the Sound() will call repeat again after playing the sound, going into a sort of infinite loop.
I saw the brilliant idea here
I'd be happy to hear the outcome.
Cheers!
Jewel
Bookmarks