Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-19-2011, 09:45 PM
macropod's Avatar
macropod macropod is offline how can I restrict what characters are allowed in an activex field? Windows 7 64bit how can I restrict what characters are allowed in an activex field? Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
The modification is not allowed because selection is locked aligahk06 Word 0 09-06-2010 06:28 AM
Powerpoint and Activex kartlee PowerPoint 0 09-02-2010 06:48 AM
Junk characters (box-like characters) in Word file Sashikala Word 1 04-20-2010 02:03 PM
Trick to restrict opening excel/word ?? 9morebusy Excel 0 11-12-2008 04:18 AM
ActiveX Cquinn Outlook 0 02-08-2006 06:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft