SetFocus to beginning of box?

I

Ian

Using Word 97.

I want to move the cursor to the left-hand end of a text box. I've
tried:

.Mybox.SetFocus

but if the box already contains text, the cursor moves to the *end* of
the text. How do I move the cursor to the *beginning* of the text?
 
C

Cindy M -WordMVP-

Hi Ian,

Me.TextBox1.SetFocus
Me.TextBox1.SelStart = 0
I want to move the cursor to the left-hand end of a text box. I've
tried:

.Mybox.SetFocus

but if the box already contains text, the cursor moves to the *end* of
the text. How do I move the cursor to the *beginning* of the text?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
I

Ian

Many thanks Cindy. Why don't the VBA books I read (or the VBA help
files) say this anywhere?
 
C

Cindy M -WordMVP-

Hi Ian,
Many thanks Cindy. Why don't the VBA books I read (or the VBA help
files) say this anywhere?
There are so many different things you can do with VBA (especially
when Word is involved) that any book that covers all the points would
probably run into 3000 pages, or so...

Sometimes, the best thing to do is type Me.TextBox1. and just look at
all the entries the VB Editor should list for you as part of
Intellisense. When you find one that looks like it might be close to
what you need, press TAB to select it, then F1 to open the Help for
the topic. Even if you don't find what you're looking for, you learn
a lot <g>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top