Hi, this is still about disabling and enabling the sound files.
Using Forum Contributor, Squeaky's idea, I came up with some VBA codes.
The idea is this:
I'm using a toggle button to simulate a "Turn Sound ON/OFF" button.
Press once, a cell will display the word TRUE and if press a second time,
that cell will display the word FALSE.
This cell that displays the TRUE & FALSE word is linked to a module which contains
the coding for playing the sound wave files.
If the cell displays FALSE, the sound file will not be played, else (if TRUE)
the sound will play.
To test if the disabling and enabling the sound works, I've a cell where the
user types in the letter A or B and click the "Answer" button (to run the macro).
Typing either A or B will cause a message box to display, accompanied by a sound.
So if by toggling the "Turn Sound ON/OFF" button, one should expect to hear the sound
or hear no sound.
However, the coding ran into a problem:
"Compile error: User-defined type not defined" in Module 2 on "Dim BM As ActiveWorkSheets".
I've attached a sample of the Excel file so that what I mentioned above made sense.
.Module 2 contains the coding for playing the sound files from C:\Windows\Media.
.Module 1 contains the coding for A & B message boxes & "Call Playwav".
.Codes in Sheet1 is for the toggle button.
I hope someone can help solve that error or improve on the coding to make it
more efficient.
Thank you.
ChanKS
Bookmarks