Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Highlight text in textbox | Excel Programming | |||
Highlight text in Textbox | Excel Programming | |||
Highlight the contain of textbox and radio button | Excel Programming | |||
Highlight all Text in a Textbox when the textbox is selected | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |