C
call_me_sol
Hi -
I'm using the following code in a userform to prevent users from
entering a space in a textbox:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii = 32) Then
MsgBox "Please enter customer name without using spaces",
vbOKOnly + vbExclamation
KeyAscii = 0
Exit Sub
End If
End Sub
This works fine -- if the user is typing in the box
This does not work fine if the user copies and pastes into the box
(the box will accept the space)
Can someone suggest a way to fix?
Thank you!
I'm using the following code in a userform to prevent users from
entering a space in a textbox:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If (KeyAscii = 32) Then
MsgBox "Please enter customer name without using spaces",
vbOKOnly + vbExclamation
KeyAscii = 0
Exit Sub
End If
End Sub
This works fine -- if the user is typing in the box
This does not work fine if the user copies and pastes into the box
(the box will accept the space)
Can someone suggest a way to fix?
Thank you!