ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TextBox.Activate - QUICKY OFF THE TOP OF SOMEONES HEAD (https://www.excelbanter.com/excel-programming/300911-textbox-activate-quicky-off-top-someones-head.html)

jason

TextBox.Activate - QUICKY OFF THE TOP OF SOMEONES HEAD
 
When I use TxtName.Activate (where TxtName is a textbox with some
narrative already in it) I'd like all the text to be selected, rather
than the cursor just ending up at the end of the narrative.

Any help greatly appreciated

Jason

Chip Pearson

TextBox.Activate - QUICKY OFF THE TOP OF SOMEONES HEAD
 
Jason,

Use the SelStart and SelLength properties. E.g,

With Me.TextBox1
.SelStart =0
.SelLength = Len(.Text)
.SetFocus
End With

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"jason" wrote in message
om...
When I use TxtName.Activate (where TxtName is a textbox with

some
narrative already in it) I'd like all the text to be selected,

rather
than the cursor just ending up at the end of the narrative.

Any help greatly appreciated

Jason




Rob Bovey

TextBox.Activate - QUICKY OFF THE TOP OF SOMEONES HEAD
 
Hi Jason,

TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"jason" wrote in message
om...
When I use TxtName.Activate (where TxtName is a textbox with some
narrative already in it) I'd like all the text to be selected, rather
than the cursor just ending up at the end of the narrative.

Any help greatly appreciated

Jason




jason

TextBox.Activate - QUICKY OFF THE TOP OF SOMEONES HEAD
 
THANKS FOLKS - KNEW IT WOULD BE A QUICK ONE FOR SOMEONE

JASON

"Chip Pearson" wrote in message ...
Jason,

Use the SelStart and SelLength properties. E.g,

With Me.TextBox1
.SelStart =0
.SelLength = Len(.Text)
.SetFocus
End With

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"jason" wrote in message
om...
When I use TxtName.Activate (where TxtName is a textbox with

some
narrative already in it) I'd like all the text to be selected,

rather
than the cursor just ending up at the end of the narrative.

Any help greatly appreciated

Jason



All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com