#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default WAV FILE

how can i get a wav file to play in excel xp as an alarm when a value in a
particular cell has been exceeded?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default WAV FILE

Give this a try... If the value in Cell A1 on the sheet that this code is
placed in is change to anything greater than 100 then the wave file plays...

Option Explicit

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_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value 100 Then _
PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav"
End Sub

--
HTH...

Jim Thomlinson


"bassfisher" wrote:

how can i get a wav file to play in excel xp as an alarm when a value in a
particular cell has been exceeded?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default WAV FILE



"Jim Thomlinson" wrote:

Give this a try... If the value in Cell A1 on the sheet that this code is
placed in is change to anything greater than 100 then the wave file plays...

Option Explicit

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_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value 100 Then _
PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav"
End Sub

--
HTH...

Jim Thomlinson


"bassfisher" wrote:

how can i get a wav file to play in excel xp as an alarm when a value in a
particular cell has been exceeded?

Jim,

i placed the code in the worksheet, changed the cell values, but it wont'
play a file!
i am new to programming in excel.
any help would be appreciated.

thanx,
bassfisher
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default WAV FILE

Hi

See John's example
http://www.j-walk.com/ss/excel/tips/tip87.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"bassfisher" wrote in message ...
how can i get a wav file to play in excel xp as an alarm when a value in a
particular cell has been exceeded?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File:1 and File:2 -- Double Files when Opening One File dallin Excel Discussion (Misc queries) 1 January 25th 07 02:53 AM
I saved file A over file B. Can I get file B back? Lynn Excel Discussion (Misc queries) 2 May 12th 06 11:24 AM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
I SAVED A FILE OVER ANOTHER A FILE IN EXCEL. THE OLD FILE WAS AN . DUFFER8MCD Excel Discussion (Misc queries) 1 December 23rd 04 11:32 PM
i received a file that reads powerpoint document file file exten. CCAROLACEREC Excel Discussion (Misc queries) 1 December 4th 04 05:02 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"