Hola, que tal?.
Tengo un código de Ivan F. Moala para reproducir un archivo wav desde
Excel pero este código reproduce el archivo que está en el disco duro.
Tiene tres macros, una es el play otra es loop reproduce repetidamente
y otra es el stop. Como puedo hacer lo mismo pero sin hacer referencia
a un archivo externo?, me refiero a incrustar el sonido.wav en el
libro Excel.
El código de Moala:
Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_LOOP = &H8
Private Const strSaveAs As String = "C:\Pruebas\sonido.wav"
Sub PlayBack()
WAVPlay strSaveAs
End Sub
Sub PlayBackLoop()
WAVLoop strSaveAs
End Sub
Sub PlayBackStop()
Call WAVPlay(vbNullString)
End Sub
Sub WAVLoop(File As String)
Dim SoundName As String
Dim wFlags As Long
Dim x As Long
SoundName = File
wFlags = SND_ASYNC Or SND_LOOP
x = sndPlaySound(SoundName, wFlags)
If x = 0 Then MsgBox "Can't play " & File
End Sub
Sub WAVPlay(File As String)
Dim SoundName As String
Dim wFlags As Long
Dim x As Long
SoundName = File
wFlags = SND_ASYNC Or SND_NODEFAULT
x = sndPlaySound(SoundName, wFlags)
If x = 0 Then MsgBox "Can't play " & File
End Sub
Gracias y un saludo
Leer las respuestas