Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
At Chip's site the directions say to run this ListWavFiles code, which I did and it did list the sounds as per per instructions.
Then per instructions (see below) run the PlayActiveCellSound code with a sound selected on the worksheet. This errors out on the single line of code with <PlayTheSound highlighted. Wants a "sub or method defined..." Have tried it in the sheet and an insert module. http://www.cpearson.com/excel/PlaySound.aspx Option Explicit Sub ListWavFiles() Dim N As Long Dim FSO As Object Dim FF As Object Dim F As Object Set FSO = CreateObject("Scripting.FileSystemObject") Set FF = FSO.GetFolder(Environ("SystemRoot") & "\Media") For Each F In FF.Files N = N + 1 Cells(N, 1) = F.Name Cells(N, 2) = F.Path Next F ActiveSheet.Columns(1).AutoFit End Sub 'This code will list in column A all the wav files in _ 'C:\Windows\Media and put the fully qualified file name in column B. _ 'To play one of these sounds, select the cell in either column A or B and execute the following code: Sub PlayActiveCellSound() PlayTheSound ActiveCell.Text End Sub Thanks, Howard |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Howard,
Am Mon, 11 Mar 2013 11:30:55 -0700 (PDT) schrieb Howard: Sub PlayActiveCellSound() PlayTheSound ActiveCell.Text End Sub in a standard module: Private Declare Function sndPlaySound Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_LOOP = &H8 Const SND_PURGE = &H40 Public Sub SoundPlayAsyncOnce(Sound As String) 'SND_SYNC to play assynchron sndPlaySound Sound, SND_ASYNC End Sub Then put a activeX-CommandButton on the sheet and copy this code to the button: Private Sub CommandButton1_Click() SoundPlayAsyncOnce ActiveCell.Value End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Monday, March 11, 2013 12:07:42 PM UTC-7, Claus Busch wrote:
Hi Howard, Am Mon, 11 Mar 2013 11:30:55 -0700 (PDT) schrieb Howard: Sub PlayActiveCellSound() PlayTheSound ActiveCell.Text End Sub in a standard module: Private Declare Function sndPlaySound Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_LOOP = &H8 Const SND_PURGE = &H40 Public Sub SoundPlayAsyncOnce(Sound As String) 'SND_SYNC to play assynchron sndPlaySound Sound, SND_ASYNC End Sub Then put a activeX-CommandButton on the sheet and copy this code to the button: Private Sub CommandButton1_Click() SoundPlayAsyncOnce ActiveCell.Value End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 Claus, Bells & whistles & Hi-Ho's galore! That does it and I thank you. Regards, Howard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Chip Pearson UDF returns #VALUE! error please help, just cannotfigure out why? | Excel Programming | |||
Thank you Chip Pearson | Excel Discussion (Misc queries) | |||
Chip Pearson | Excel Programming | |||
CHIP PEARSON - THANX | Excel Programming | |||
Chip Pearson or someone | Excel Programming |