Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
Does anyone know if it is possible to have Excel play a sound clip as a
result of conditional formatting... ? Or maybe as a macro ? I'm a fairly junior Excel user, so go easy, k ? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
You can play a sound with a VBA call to a Windows API:
Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub AAA() sndPlaySound32 "chimes.wav", 0 End Sub Change "chimes.wav" to the sound file you want to play. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "sparky" wrote in message ... Does anyone know if it is possible to have Excel play a sound clip as a result of conditional formatting... ? Or maybe as a macro ? I'm a fairly junior Excel user, so go easy, k ? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
Really appreciate your help, Chip!
....not certain where/how to insert this code, however. can you spare another moment to tell me ?? Thx again, JohnC "Chip Pearson" wrote: You can play a sound with a VBA call to a Windows API: Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub AAA() sndPlaySound32 "chimes.wav", 0 End Sub Change "chimes.wav" to the sound file you want to play. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "sparky" wrote in message ... Does anyone know if it is possible to have Excel play a sound clip as a result of conditional formatting... ? Or maybe as a macro ? I'm a fairly junior Excel user, so go easy, k ? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
Hi John, (this is old from Dec 3rd to 5th but it looked like you are waiting for an answer)
You did not really describe what you wanted to do. What Chip gave you was macro code that you can invoke a macro to play a chime (which you asked for), but you can't use it in Conditional Formatting. You can read more about Conditional Formatting in http://www.mvps.org/dmcritchie/excel/condfmt.htm but be aware that playing a chime is not formatting so you can't use Conditional Formatting. Since you want a chime it is probably to be used as an error condition that you want them to correct the data just entered in error, in which case you probably want to look at cell validation. (try the Flash presentation first) http://www.mvps.org/dmcritchie/excel/validation.htm http://www.contextures.com/tiptech.html -- Data Validation http://www.datapigtechnologies.com/ExcelMain.htm -- Data Validation [Flash presentation] Additional places to find Excel Tutorials on http://www.mvps.org/dmcritchie/excel....htm#tutorials If you want to do something yourself using a Change Event macro Install Chip's code at the TOP of a standard module -- a new module in your personal.xls would be fine as the declarations above the SUB should be at the top. I'll change the name from AAA to chimes. If you have never installed a macro in your personal.xls see http://www.mvps.org/dmcritchie/excel/getstarted.htm additional help in calling a function or a macro in http://www.mvps.org/dmcritchie/excel/install.htm Option Explicit Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub chimes() sndPlaySound32 "chimes.wav", 0 End Sub You can call that macro from another macro Application.Run "personal.xls!chimes" You could for instance call it from an Event macro, which cannot have your Function in it but you can call a macro that uses the function. More on Event macros in http://www.mvps.org/dmcritchie/excel/event.htm Two event macros examples one for a double-click and one to chime if not numeric or number is greater than 360. Install as a worksheet macro by right click on sheet tab then "View Code" and then insert the following code. Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.Run "personal.xls!chimes" End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 Then On Error GoTo errors If Target.Value 360 Then GoTo errors End If Exit Sub errors: On Error GoTo 0 Application.Run "personal.xls!chimes" End Sub --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "sparky" wrote in message ... Really appreciate your help, Chip! ...not certain where/how to insert this code, however. can you spare another moment to tell me ?? Thx again, JohnC "Chip Pearson" wrote: You can play a sound with a VBA call to a Windows API: Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub AAA() sndPlaySound32 "chimes.wav", 0 End Sub Change "chimes.wav" to the sound file you want to play. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "sparky" wrote in message ... Does anyone know if it is possible to have Excel play a sound clip as a result of conditional formatting... ? Or maybe as a macro ? I'm a fairly junior Excel user, so go easy, k ? |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
Hi Jeff, (posted to excel.misc)
Hopefully you would only ever send the wave file once, and I expect people would only want one copy. i.e. c:\winnt\system32\winmm.dll so other than a note as to where they might install the .wav file I don't see packaging them in the same email if your are going to update the Excel file regularly. The example given was one that they would already have. Anyway I wouldn't know how to automatically search the system for the .dll and include it in the email. As far a embedding them in a workbook don't know how, aren't the big enough now. Using those keywords though here is a posting by Chip Pearson using OLEObjects.Add have no idea whether it does what you want. http://groups.google.com/groups?thre...%40tkmsftngp02 -- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "jeffP" wrote... My [additional] problem is I want to send a workbook to someone via email attachment and therefore I lose the wav file referred to in the macro. Any idea how to "attach" or "imbed" the related files to the workbook? |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
sound clip as a result of conditional formatting... ?
David,
I wasn't thinking so much of the winmn.dll but the wav file itself( ie audio into notes to Joe.wav) that I would like to open when he opens the workbook. Yes, a repetitive workbook would make sense to send the wav file separtately but a one time workbook...... I'll check your suggested link on OLE objects and again thanks. "David McRitchie" wrote: Hi Jeff, (posted to excel.misc) Hopefully you would only ever send the wave file once, and I expect people would only want one copy. i.e. c:\winnt\system32\winmm.dll so other than a note as to where they might install the .wav file I don't see packaging them in the same email if your are going to update the Excel file regularly. The example given was one that they would already have. Anyway I wouldn't know how to automatically search the system for the .dll and include it in the email. As far a embedding them in a workbook don't know how, aren't the big enough now. Using those keywords though here is a posting by Chip Pearson using OLEObjects.Add have no idea whether it does what you want. http://groups.google.com/groups?thre...%40tkmsftngp02 -- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "jeffP" wrote... My [additional] problem is I want to send a workbook to someone via email attachment and therefore I lose the wav file referred to in the macro. Any idea how to "attach" or "imbed" the related files to the workbook? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional Formatting | Excel Discussion (Misc queries) | |||
Conditional Formatting Error | Excel Worksheet Functions | |||
difficulty with conditional formatting | Excel Discussion (Misc queries) | |||
conditional formatting question | Excel Discussion (Misc queries) | |||
Copy conditional formatting across multiple rows? | Excel Discussion (Misc queries) |