View Single Post
 
Old 06-19-2011, 09:45 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Joe,

You could prevent the invalid characters being typed into the ActiveX control by adding the following sub to it:
Code:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
  'Prevent input of: / \ : * ? " < > |
  Case 47, 92, 58, 42, 63, 34, 60, 62, 124
    Beep
    KeyAscii = 0
  Case Else
End Select
End Sub
Note: There's probably a whole range of other invalid characters, but I've limited the 'exclusions' to those you mentioned.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote