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 ?