Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 9
Default highlighted text

In the "Save as" box, the name of a workbook is pre-highlighted for you to
change it. How do I do the same in a user form ?

I have a form with a text box... say txtbox1, I also have set a default
value of "0" in the txtbox1.
I set focus on txtbox1 when form is shown but the zero is not hightlighted
like I want...

Any tips?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default highlighted text


Hello MD,

Copy and paste this code into a standard VBA Module.

To add a Module to project:
1) Press Alt + F11 in Excel to open the VB Editor
2) Press Alt + I to activate the Insert menu
3) Press M to add a Module

Public Sub HighlightTextBox(TextBox_Name As String)

'Highlight TextBox Text

With UserForms(0).Controls(TextBox_Name)
..SetFocus
..SelStart = 0
..SelLength = Len(.Text)
End With

End Sub


Calling the Macro:
Enclose the name of the TextBox whose text you want to highlight in
quotes.

HighlightTextBox "txtbox1"


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=546556

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
i would like to sum only highlighted text in a row Mike Excel Discussion (Misc queries) 2 May 7th 08 12:19 AM
Add text to cells highlighted in rose Studebaker Excel Discussion (Misc queries) 3 December 3rd 07 04:28 PM
HELP!!! I am unable to see colored text or highlighted cells ... Frustrated beyond words Excel Discussion (Misc queries) 1 April 3rd 07 10:21 PM
find specific text and make cell highlighted after the future Excel Discussion (Misc queries) 2 May 26th 06 02:11 PM
Highlighted Text And/Or Cells M.A.Tyler Excel Discussion (Misc queries) 3 February 5th 06 02:42 AM


All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"