ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making a "ding" sound in the macro process (https://www.excelbanter.com/excel-programming/419616-making-ding-sound-macro-process.html)

iashorty

Making a "ding" sound in the macro process
 
Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.



Chip Pearson

Making a "ding" sound in the macro process
 
Try some code like the following:

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

Sub PlayChimes()
Dim N As Long
For N = 1 To 5
sndPlaySound32 "chimes", 0
Next N
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 07:20:01 -0800, iashorty
wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.


Mike H

Making a "ding" sound in the macro process
 
Hi,

On the assumption you have speakers and they are switched on your code will
produce 5 beeps. However they will be so quick you will only hear one of
them. Introduce a pause with this line


Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Application.Wait (Now + TimeValue("0:00:01"))
Next counter
End Sub

Mike

"iashorty" wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.



iashorty

Making a "ding" sound in the macro process
 
I don't understand your declaration Function paragraph. Is this exactly what
I should type?


"Chip Pearson" wrote:

Try some code like the following:

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

Sub PlayChimes()
Dim N As Long
For N = 1 To 5
sndPlaySound32 "chimes", 0
Next N
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 07:20:01 -0800, iashorty
wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.



iashorty

Making a "ding" sound in the macro process
 
I don't even hear one beep. Putting a hesitation in the macro didn't help. I
hear the beeping of a new Lotus Sametime coming in so I know the speakers are
on.


"Mike H" wrote:

Hi,

On the assumption you have speakers and they are switched on your code will
produce 5 beeps. However they will be so quick you will only hear one of
them. Introduce a pause with this line


Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Application.Wait (Now + TimeValue("0:00:01"))
Next counter
End Sub

Mike

"iashorty" wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.



iashorty

Making a "ding" sound in the macro process
 
i need to explain that I am an accountant not a programmer. I have not had
any Visual Basic, just a logic and some experience in Excel and writing
macros. What I don't know, I've had to ask for help. Assume I know nothing
and maybe this will make sense to me.



"Chip Pearson" wrote:

Try some code like the following:

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

Sub PlayChimes()
Dim N As Long
For N = 1 To 5
sndPlaySound32 "chimes", 0
Next N
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 07:20:01 -0800, iashorty
wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.



Chip Pearson

Making a "ding" sound in the macro process
 
The "Declare" statement is used to specify a function that resides in
a Windows DLL file, which is completely and fully disconnected in
every way from VBA and Excel. Windows is a collections of hundreds (?)
of individual DLL files (DLL = Dynamic Link Library), organized by
functionality. When you "Declare" a function, you instruct VBA to go
to that DLL file and execute the named function in that DLL. The
"Declare" statement must reside before and outside of any VBA
procedure (e.g., a Sub or Function procedure). It is worth noting
that when you use a DLL function with a Declare statement, you are
bypassing all of VBA's safety and error mechanisms. Any error in the
declaration of the DLL function or in the parameters passed to that
functions will likely cause Excel to crash. DLL functions can allow
you to do things not supported by Excel/VBA and they are very fast,
but they can be dangerous because VBA isn't involved to handle errors.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 08:10:14 -0800, iashorty
wrote:

I don't understand your declaration Function paragraph. Is this exactly what
I should type?


"Chip Pearson" wrote:

Try some code like the following:

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

Sub PlayChimes()
Dim N As Long
For N = 1 To 5
sndPlaySound32 "chimes", 0
Next N
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 07:20:01 -0800, iashorty
wrote:

Here is a macro written by someone before me:
Sub ding1()
'
' Ding Macro
MultiBeep 5
Message
End Sub

Sub MultiBeep(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub

Sub Message()
MsgBox "Sorry, I have not been assigned yet!"
End Sub

The macro goes through the process but the dings are not audible. I was
instructed to make this work, but I can't find any information on Beeps or
Dings.




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com