View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kartune85[_22_] kartune85[_22_] is offline
external usenet poster
 
Posts: 1
Default Difficulty restricting characters


I've used the following code to try and restrict certain characters to a
textbox:

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc(".")
If InStr(1, Me.TextBox1.Text, ".") 0 Then
KeyAscii = 0
End If
End Select
End Sub

The period is not the only character I'm trying to restrict but it is
one of them. Whenever I've tried to use 'Select Case', the code never
seems to do anything... at all. The Textbox2 is used as the savename so
I can't allow any weird characters to get typed in.

Can anyone help me out regarding this?

Thanks,

Kartune85


--
kartune85
------------------------------------------------------------------------
kartune85's Profile: http://www.excelforum.com/member.php...o&userid=35586
View this thread: http://www.excelforum.com/showthread...hreadid=569743