Solved

Beep is beeping only once

Posted on 2003-12-04
7
366 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now