Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Programming an unusual action

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Programming an unusual action

the workbook_Open event fires when a workbook is opened if the user does not
disable macros.

See Chip Pearson's page on events'
http://www.cpearson.com/excel/events.htm

for sounds:

http://support.microsoft.com/default...b;en-us;213777
XL2000: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]

http://support.microsoft.com/default...b;en-us;170730
WD: How to Play a .wav Sound File by Using a Macro

http://support.microsoft.com/default...b;en-us;211842
WD2000: How to Play a .wav Sound File Using a Macro

http://support.microsoft.com/default...b;en-us;193223
HOWTO: Use the MessageBeep API to Play System .WAV Files

--
Regards,
Tom Ogilvy


"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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Programming an unusual action

Thanks a lot! -- Dave
--
DAS


"Bob Phillips" wrote:

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Programming an unusual action

Thank you very much!
--
DAS


"Tom Ogilvy" wrote:

the workbook_Open event fires when a workbook is opened if the user does not
disable macros.

See Chip Pearson's page on events'
http://www.cpearson.com/excel/events.htm

for sounds:

http://support.microsoft.com/default...b;en-us;213777
XL2000: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...b;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default...kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]

http://support.microsoft.com/default...b;en-us;170730
WD: How to Play a .wav Sound File by Using a Macro

http://support.microsoft.com/default...b;en-us;211842
WD2000: How to Play a .wav Sound File Using a Macro

http://support.microsoft.com/default...b;en-us;193223
HOWTO: Use the MessageBeep API to Play System .WAV Files

--
Regards,
Tom Ogilvy


"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




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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
3D chart - unusual ORF!N Charts and Charting in Excel 1 September 23rd 09 06:48 PM
Unusual Request... LewisAire Excel Discussion (Misc queries) 0 July 31st 06 12:08 PM
Please help with unusual request? AWA Excel Discussion (Misc queries) 4 December 26th 05 08:13 PM
Unusual question Daniel Bonallack[_2_] Excel Programming 3 December 10th 03 02:18 PM


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

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

About Us

"It's about Microsoft Excel"