H
Howard
This is a shortened list of sounds in column R, sheet 1. And is the list for a data validation drop down in H1.
C:\Windows\Media\ir_end.wav
C:\Windows\Media\ringout.wav
C:\Windows\Media\Speech Misrecognition.wav
This is in Module 1:
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 SoundPlayAsyncOnce(Sound As String)
'SND_SYNC to play assynchron
sndPlaySound Sound, SND_ASYNC
End Sub
This is in sheet1 vb editor:
Option Explicit
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub TingleTunes()
'Dim iSnd As string
'Set iSnd = Range("H1").Value
'SoundPlayAsyncOnce iSnd.Value
'SoundPlayAsyncOnce iSnd.Value
SoundPlayAsyncOnce ActiveCell.Value
End Sub
As is, it works fine to select a sound in R column and run Sub TingleTunes().
The commented out code lines is my attempt to select a sound from the drop down and run TingleTunes to play the selected sound.
I get object required error.
Thanks.
Howard
C:\Windows\Media\ir_end.wav
C:\Windows\Media\ringout.wav
C:\Windows\Media\Speech Misrecognition.wav
This is in Module 1:
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 SoundPlayAsyncOnce(Sound As String)
'SND_SYNC to play assynchron
sndPlaySound Sound, SND_ASYNC
End Sub
This is in sheet1 vb editor:
Option Explicit
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub TingleTunes()
'Dim iSnd As string
'Set iSnd = Range("H1").Value
'SoundPlayAsyncOnce iSnd.Value
'SoundPlayAsyncOnce iSnd.Value
SoundPlayAsyncOnce ActiveCell.Value
End Sub
As is, it works fine to select a sound in R column and run Sub TingleTunes().
The commented out code lines is my attempt to select a sound from the drop down and run TingleTunes to play the selected sound.
I get object required error.
Thanks.
Howard