Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Highlight (ie Select characters in a textbox)

Is there a way with programming to select a certain string of characters in a
Form TextBox. For example: Lets say the TextBox's value is:

"This is the example I want to use."

Is there a way without using the mouse to highlight the word example in that
phrase.

Thank you,

Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Highlight (ie Select characters in a textbox)

Change the TextBox's HideSelection property to False (otherwise you would
have to set focus to the TextBox in order to see the highlight) and then use
the SelStart and SelLength properties of the TextBox to highlight the text.
Here is some example code...

Dim Word As String
Word = "example"
With Me.TextBox1
.SelStart = InStr(1, .Text, Word, vbTextCompare) - 1
.SelLength = Len(Word)
End With

--
Rick (MVP - Excel)


"Steven" wrote in message
...
Is there a way with programming to select a certain string of characters
in a
Form TextBox. For example: Lets say the TextBox's value is:

"This is the example I want to use."

Is there a way without using the mouse to highlight the word example in
that
phrase.

Thank you,

Steven


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
Highlight text in textbox Erik Excel Programming 2 October 17th 08 02:26 PM
Highlight text in Textbox jnf40 Excel Programming 3 January 2nd 08 10:53 PM
Highlight the contain of textbox and radio button Peter Cheang Excel Programming 0 August 11th 06 04:50 PM
Highlight all Text in a Textbox when the textbox is selected RPIJG[_73_] Excel Programming 3 October 28th 05 08:28 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


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

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"