Results 1 to 2 of 2

Thread: Key ascii? "

  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: Key ascii? "

    I want to find out if the 1st char in a strig is " how can i do this?

    using vba

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Try this.......
    Code:
    If Left(myString, 1) = Chr$(34) Then
       Msgbox "the first character in the string is a quote mark (" & Chr$(34) & ")"
    End if

    if you are trying to determine whether or not the first character being typed into a textbox is a Quotation mark (") then place this code into a code window for the KeyDown event of your entry textbox:

    Code:
    If KeyCode = 34 then
       MsgBox"HEY.....QUOTES NOT ALLOWED DUDE!!" 
       KeyCode = 0
    End if
    Ummmm...you don't really need the Msgbox...
    You can just use the KeyCode = 0. That way if the Quote is hit on the keyboard, it is simply ignored.

    Code:
    If KeyCode = 34 Then KeyCode = 0



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •