Perhaps use the GetAsyncKeyState() API within the the MouseDown event:
The Code:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const VK_LBUTTON = &H1
Private Const VK_RBUTTON = &H2
Private Sub Form1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim tTimer As Single
If Button = vbLeftButton Then
' Loop while the Left Mouse is depressed.
Do While GetAsyncKeyState(VK_LBUTTON) <> 0
' Perform your "While Mouse is Down" code in
' this "While" loop.
If (Timer - tTimer) > 0.05 Then
' Increment a Textbox value (using a delay to slow the increment)
Text1.Text = Val(Text1.Text) + 1
tTimer = Timer
End If
DoEvents
Loop
End If
If Button = vbRightButton Then
' Loop while the Right Mouse is depressed.
Do While GetAsyncKeyState(VK_RBUTTON) <> 0
' Perform your "While Mouse is Down" code in
' this "While" loop.
If (Timer - tTimer) > 0.05 Then
' Decrement a Textbox value (using a delay to slow the decrement)
Text1.Text = Val(Text1.Text) - 1
tTimer = Timer
End If
DoEvents
Loop
End If
End Sub