+ Reply to Thread
Results 1 to 3 of 3

Textbox.selstart

  1. #1
    Registered User
    Join Date
    06-11-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Unhappy Textbox.selstart

    I have been working on a small project to import set of records from a text file and to split them into columns in excel.

    I have designed a vba form that takes inputs from a mail copy and use regex patterns to capture and split the text.

    Sample input

    ID# start date end date cutomerid descr
    2334 06/05 10:10 06/05 12:10 24456 Jonh - The user has had requested access to storage department.

    2338 06/05 11:10 06/05 13:10 24459 Johna - payroll recheck needed.

    I instruct user to copy paste the information into a text box in a form and use regex to capture each record. I am trying to highlight each of the record identified in the text box. Instr gives the correct position but when I use textbox1.selstart and sellength the text is not highlighted correctly. Meaning the position which instr gives cannot select the start position using selstart. The two values differ. I guess instr does not take into account non printable characters but selstart does.

    How this can be resolved ?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Textbox.selstart

    Hello edatawiz,

    Welcome to the Forum!

    I instruct user to copy paste the information into a text box in a form and use regex to capture each record.
    How do your users run Regular Expressions (RegEx) in Excel without being in the Visual Basic Enviroment?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Textbox.selstart

    You could use Split() and Ubound() possibly.

    In this example, I used Len(). I first added a Control Toolbox Toolbar textbox control to sheet1.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1