
Tips.Net > WordTips Home > Macros > Creating Macros > Moving the Insertion Point to the End of a Line
Summary: When writing a macro to process the text in a document, you may need to move the insertion point to the end of a line. This is done with the EndKey method, described in this tip. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
If you need to move the insertion point to the end of a line under the control of a VBA macro, it is done with the EndKey method. Syntax examples are as follows:
Selection.EndKey Unit:=wdLine, Extend:=wdMove Selection.EndKey Unit:=wdLine, Extend:=wdExtend
The first line simply moves the insertion point, the second moves it and selects all the text between the current insertion point and the end of the line.
Tip #3442 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Save Time! WordTips has been published weekly since early 1997. Past issues are available in convenient WordTips archives. Have your own enhanced archive of WordTips at your fingertips, available to use at any time!
Check out WordTips Archives today!
It doesn't matter if you are a beginner or expert, the WordTips archives are the fastest way to improved productivity. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips