Use This piece of code. Place a Command Button named 'Command1' and a Timer named 'Timer1'. Set the Enabled property to True and set the Interval property to ( 1000 / (Number of ticks/sec) ).
You can add some other nice features (e.g. waiting for a specified time before begingin tick.)
Another possible feature is to raise Command1's Click event by placing
Command1.Value = True.
Here is the code:
Dim boolIsDown As Boolean
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Down"
If Button = vbLeftButton Then
Timer1.Enabled = True
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Up"
If Button = vbLeftButton Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
Beep
' Command1.Value = True ' Optional
End Sub
[sig]<p>Mohammad Mehran Nikoo<br><a href=mailto:mohmehran@yahoo.com>mohmehran@yahoo.com</a><br>MCP with experience in VB, ASP, XML, SQL, COM[/sig]