View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Programming an unusual action

Here is an example

Option Explicit

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

Private Sub Worksheet_Activate()
sndPlaySound32 "c:\windows\media\ding.wav", 0
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips

"Dave" wrote in message
...
Is it possible to to create a macro that runs when you click on a

worksheet
tab to open it, or to change the scripting to achieve that action?

Specifically, we would like to have a *.wav file play when a worksheet is
opened.

Thanks,
--
DAS