Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

Newest Tips

Setting Fraction Bar Overhang Spacing in the Equation Editor

Printing On Both Sides of the Paper

Turning Off AutoComplete for Dates

Ordering Search and Replace

Understanding Auto Line Spacing

Adding Comments to Your Document

Conditional Calculations in Word

 

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

Take Control! Master the real power behind Word! Successfully master the secrets of powerful formatting and create documents that stand out from the rest. Best of all, you can create documents that are easy to maintain and quick to change.
 
Check out Word 2007 Styles and Templates today!