Tieni presente che, in aggiunta, vale fino alla prossima 'On Error .."
che incontra.
Per cui è conveniente, oltre che esplicitamente raccomandato, avere
una gestione errore in ogni routine.
Esempio :
codice:
Private Sub Text2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo Errore_Text2_MouseDown ' <--- Questo è il punto dove si salta a seguito di un errore.
If Button = vbRightButton Then
blEsc = True
Else
blEsc = False
End If
If blEsc Then SendKeys "{ESC}"
Exit Sub ' <---- Non dimenticare di uscire.
Errore_Text2_MouseDown:
'------------------------------------------- Gestione Errore
If Err.Number = 5 Then
' Gestisco l'errore 5 ........
End If
'-----------------------------------------------------------
End Sub
Ciao,