Thread: sound
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
dougw dougw is offline
external usenet poster
 
Posts: 4
Default sound

hmmmmmmmm, Well I am in no way an expert with excel or VBA programming.
This is an update for something I found out on the superinformation highway
( hope that does not date me ... lol )... seems that adding this line stops
it from
asking for the save. ActiveCell.Offset(0, 0).Select. So I added it the end
of my sub:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

Dim WFile As String

WFile = ActiveCell.Value + ".wav"
WFile = ThisWorkbook.Path & "\" & WFile
PlayWavFile (WFile)
ActiveCell.Offset(0, 0).Select
End Sub


works like a charm.... thanks again

========================================
"dougw" wrote in message
news:WrW_j.298528$pM4.11715@pd7urf1no...
I am trying to click on a cell and have it play a wav file.... I have that
part working fine ( I belive )

But when I close excel after playing 1 or more wavs if always ask me if I
want to save changes
and I get the popup after only playing a file...no other changes.
Is there a way around this.... thanks



Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
(ByVal lpszName As String, _
hModule As Long, _
ByVal dwFlags As Long) As Long


Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

Dim WFile As String

WFile = ActiveCell.Value + ".wav"
WFile = ThisWorkbook.Path & "\" & WFile
PlayWavFile (WFile)
End Sub