'--------- Code for a Class Module Named Class1 ---------
Option Explicit
Public WithEvents cls_txb As MSForms.TextBox
Public WithEvents cls_cmb As MSForms.ComboBox
Sub SetTextBox(ByVal txb As MSForms.TextBox)
Set cls_txb = txb
End Sub
Sub SetComboBox(ByVal cmb As MSForms.ComboBox)
Set cls_cmb = cmb
End Sub
Private Sub cls_txb_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
LostFocus objPre
End Sub
Private Sub cls_cmb_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
LostFocus objPre
End Sub
Private Sub cls_txb_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
CallLoastFocus KeyCode, cls_txb
End Sub
Private Sub cls_cmb_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
CallLoastFocus KeyCode, cls_cmb
End Sub
Private Sub CallLoastFocus(ByVal KeyCode As Long, ByVal MSFCtrl As MSForms.Control)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 40 Or KeyCode = 38 Then
LostFocus MSFCtrl
End If
End Sub