Word VBA: Where is the insertion point in a Textbox?

Posted on 2011-10-19
Medium Priority
Last Modified: 2012-06-27
I have a textbox and need to know the current location of the insertion point in the text so that I can check the character to the immediate left of the insertion point. I will be getting this information inside a KeyPress Sub. If possible, I would like to know the location as the number of characters between the current location and the start of the text.
Thanks for any help.
Question by:JohnRobinAllen
LVL 76

Accepted Solution

GrahamSkan earned 800 total points
ID: 36993621
There is a SelStart property that tells you where the beginning of the selection is. You might also find the SelLength and the SelText properties useful.

Author Closing Comment

ID: 36993759
The answer came so quickly that I have not had a chance to test it. However, since it comes from Graham Skan, I know that the solution will be correct.
    Many thanks

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question