Results 1 to 5 of 5

Thread: Removing words from a textbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    94

    Removing words from a textbox

    i'm stuck

    i can't seem to make a code to remove a word, and everything after it. the word will always be "status"

    how can i remove that and everything after it, but keep everything before it?

    thank you

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    VB Code:
    1. Dim strWord As String
    2.     Dim pos As Long
    3.     strWord = "this is a status check"
    4.     pos = InStr(1, strWord, "status", vbTextCompare)
    5.     If pos > 0 Then
    6.         strWord = Left$(strWord, pos - 1)
    7.     End If
    8.     Debug.Print strWord

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    94
    thanks!

    i'm not good with this kind of stuff yet

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    What about

    VB Code:
    1. TextBox1.Text = Replace(TextBox1.Text, "status", "")

    (Assuming same case)

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Aah never mind, I didn't read the post correctly.

    Leave me alone.

Posting Permissions

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



Click Here to Expand Forum to Full Width