Bob Morrison
New Member
- Joined
- Dec 11, 2009
- Messages
- 31
In XL 2010 is it possible to have a picture in a Cell and it plays an Audio file if you click on it?
' sheet module
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
Sub PlayWAV()
Dim wf$
wf = ThisWorkbook.Path & "\beaming.wav" ' same path as workbook
PlaySound wf, 0&, SND_ASYNC Or SND_FILENAME
End Sub
I think I may have to replace part of your code with my sound file and location?
' sheet module
Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub OpenPlay()
Dim fp$, lngErr&
fp = "c:\pub\opening.wma" ' your sound file path here
lngErr = ShellExecute(0, "OPEN", fp, "", "", 0)
End Sub