G
Guest
Hi everyone
I have check other similar messages and tried different things but cannot get the focus on the textbox control when an invalid entry is made
The code follows
' ******************************************************************
Private Sub txtChangeDate_Exit(ByVal Cancel As MSForms.ReturnBoolean
' Jac Tremblay - 2004-05-2
With ufoFeedXl.txtChangeDat
' Check if date is valid
If IsDate(.Text) The
' Check if date is present
If Len(.Text) > 0 The
' Check that length is 10 and format is OK
If Len(.Text) <> 10 Or
Mid(.Text, 5, 1) <> "-" Or
Mid(.Text, 8, 1) <> "-" The
MsgBox "Date format must be ""yyyy-mm-dd"".
.Activat
' .SetFocu
.SelStart =
.SelLength = Len(.Text
End I
End I
Els
MsgBox "Date is invalid.
.Activat
' .SetFocu
.SelStart =
.SelLength = Len(.Text
End I
End Wit
End Su
' ******************************************************************
Some suggest to use .Activate, but this method does not exist for that control. The Setfocus never works. What can I do
Any help will be appreciated
Thanks
I have check other similar messages and tried different things but cannot get the focus on the textbox control when an invalid entry is made
The code follows
' ******************************************************************
Private Sub txtChangeDate_Exit(ByVal Cancel As MSForms.ReturnBoolean
' Jac Tremblay - 2004-05-2
With ufoFeedXl.txtChangeDat
' Check if date is valid
If IsDate(.Text) The
' Check if date is present
If Len(.Text) > 0 The
' Check that length is 10 and format is OK
If Len(.Text) <> 10 Or
Mid(.Text, 5, 1) <> "-" Or
Mid(.Text, 8, 1) <> "-" The
MsgBox "Date format must be ""yyyy-mm-dd"".
.Activat
' .SetFocu
.SelStart =
.SelLength = Len(.Text
End I
End I
Els
MsgBox "Date is invalid.
.Activat
' .SetFocu
.SelStart =
.SelLength = Len(.Text
End I
End Wit
End Su
' ******************************************************************
Some suggest to use .Activate, but this method does not exist for that control. The Setfocus never works. What can I do
Any help will be appreciated
Thanks