NewLine Method
Home Page (Objects) | Overview | FAQ | Reference
Applies to: TextSelection object
Creates a new line.
Syntax
object**.NewLine**
Parameters
object
An expression that evaluates to a TextSelection object.
Remarks
The NewLine method has the same effect as pressing the ENTER key.
In Insert mode, the NewLine method will insert a new line. In Overtype mode, the NewLine method will move the insertion point to the next line without creating a new line. However, if the insertion point is on the last line the NewLine method will add a new line after the last one.
Whether you are in insert or overtype mode, you can always create a new line by using the dsNewLine string constant. Consider the following code:
Dim sel
Set sel=ActiveDocument.Selection
sel=dsNewLine
Alternatively, you could use the TextSelection object's Text property, which is the default:
Sel.Text=dsNewLine
Additionally, you can move the insertion point to the next line by using either of the following statements:
Sel="void main()"+ dsNewLine
Sel="{"+ dsNewLine
Example
The following example creates a new line:
ActiveDocument.Selection.NewLine
See Also DestructiveInsert method, Indent method, Overtype property, Text property, Unindent method.