audio alert when a shared workbook is saved by any user

  • Thread starter Thread starter Bob W
  • Start date Start date
B

Bob W

I'd like our shared team spreadsheet to issue a little audio alert each time
someone saves the spreadsheet (thereby updating all users). Can this be done?
 
Try something like the following code in the ThisWorkbook code module. It
must go in the ThisWorkbook module, not a regular code module. Change
"Chimes" to the name of the sound you want to play.


Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
sndPlaySound "Chimes", 0
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Is that going to trigger a macro warning every time anybody opens the shared
workbook? That won't fly...people will just bypass the macro (if excel is
like Word).
 
If the user doesn't enable macros (or opens the workbook file while holding
the SHIFT key), the code won't run. Unfortunately, there is no other way to
do it.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Chip, thanks for the macro; i guess we will have to get our team together and
tell them to enable macros....
 
Back
Top