Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default limit character in textbox

Hello. I added a text box to a form I have. Is there a way to prevent the
user from using the / or \ characters in that form? Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default limit character in textbox

usually i just memorize the values then if it includes something i don't want
i reinstate the old values after update eg.... (this code goes on form
module)

dim CurVal as string
private sub Textbox1_Enter()
curval = textbox1
end sub

private sub Textbox1_afterupdate()
if instr(1,textbox1,"\") 0 or _
if instr(1,textbox1,"/") 0 then _
textbox1 = curval
end sub

ben



--
When you lose your mind, you free your life.


"Steph" wrote:

Hello. I added a text box to a form I have. Is there a way to prevent the
user from using the / or \ characters in that form? Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default limit character in textbox

should say if you want to check it as each character is type I would use this
instead

dim CurVal as string

Private sub Textbox1_enter()
curval = textbox1
end sub
Private sub Textbox1_change()
if instr(1,textbox1,"\") 0 or _
if instr(1,textbox1,"/") then
textbox1 = curval
curval = textbox1
end if
end sub

that other one only reads after a user enters data and leaves the box, this
checks each character that is typed

--
When you lose your mind, you free your life.


"Steph" wrote:

Hello. I added a text box to a form I have. Is there a way to prevent the
user from using the / or \ characters in that form? Thanks!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Character limit in textbox Ashley Excel Worksheet Functions 1 September 10th 08 01:33 AM
255 Character Limit Colin Excel Discussion (Misc queries) 2 March 2nd 06 07:58 PM
Character Limit Dylan Moran Excel Programming 5 September 9th 05 02:13 AM
how to put tab character into textbox? Dirk[_2_] Excel Programming 7 February 11th 04 09:23 AM
Limit input in a textbox James Agostinho Excel Programming 2 September 10th 03 03:10 PM


All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"