Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 32 And Len(Text1) = 0 Then KeyAscii = 0: Exit Sub If KeyAscii = 32 And Mid(Text1, Len(Text1), 1) = " " Then KeyAscii = 0 End If End Sub
Gracias por la ayuda, ya puse el codigo; no mepermite aceptar espacio al principio y eso esta muy bien, pero me sigue aceptando mas de un espacio entre cada palabra o caracter y deseo que no acepte mas de un espacion entre cada palabra o caracter.
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 32 Then If Len(Text1.Text) = 0 Then KeyAscii = 0 Exit Sub ElseIf Text1.SelStart = 0 Then KeyAscii = 0 ElseIf Text1.SelStart > 1 Then If Mid(Text1.Text, Text1.SelStart, 1) = " " Then KeyAscii = 0 ElseIf Mid(Text1.Text, Text1.SelStart + 1, 1) = " " Then KeyAscii = 0 End If End If End If End Sub