Solved

Beep is beeping only once

Posted on 2003-12-04
7
380 Views
Last Modified: 2010-05-03
I wrote the code
for i = to 5
     Beep
next i
but the computer beeps only once.
Why?
0
Comment
Question by:SaadDani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 9880601
for i = 0 to 5
     Beep
next i
0
 

Author Comment

by:SaadDani
ID: 9880614
Its the same...
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880726
Try this:

for i = 1 to 5
     Beep
     Doevents
next i

( I haven't tested it 'cos I don't have speakers at the moment )
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880750
If this doesn't work then try using Timer to do the beeping in some time interval.    (Maybe the loop goes too fast.     Loop is finished even before the first beep finishes )

Create command button and a timer:
--------------------------------------------------------------------
Private Sub Command1_Click()
    Timer1.Interval = 300
    Timer1.Tag = 0
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    Timer1.Tag = Timer1.Tag + 1
    Beep
    DoEvents
    If Timer1.Tag = 5 Then Timer1.Enabled = False
End Sub
--------------------------------------------------------------------
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 100 total points
ID: 9880751
All the beeps are merged together.
Try this
Dim i As Integer
Dim j As Long
For i = 0 To 5
     Beep
     For j = 1 To 10000000
     Next j
Next

0
 

Author Comment

by:SaadDani
ID: 9880756
dosn't help...
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880793
Timer method works fine for me.
The lowest value of Timer1.Interval that gives multiple beeps on my comp. is 50. Everything larger than this works fine.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question