Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2011, 07:36 AM
Joe Patrick Joe Patrick 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
Advanced Beginner
how can I restrict what characters are allowed in an activex field?
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default how can I restrict what characters are allowed in an activex field?

I'm exporting the data to a text file so certain characters cannot be used:
/ \ : * ? " < > |

How can I prevent users from entering those characters?



Thank you!
Reply With Quote
  #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: 21,963
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
  #3  
Old 06-20-2011, 05:32 AM
Joe Patrick Joe Patrick 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
Advanced Beginner
how can I restrict what characters are allowed in an activex field?
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default Thank you!

Paul, once again, thank you so much!
Reply With Quote
Reply



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 10:46 AM.


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