InsertLines Method

Applies To

CodeModule object.

Description

Inserts a line or lines of code at a specified location in a block of code.

Syntax

object.InsertLines(line, code)

The InsertLines syntax has these parts

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

line

Required. A Long specifying the location at which you want to insert the code.

code

Required. A String containing the code you want to insert.


Remarks

If the text you insert using the InsertLines method is carriage return–linefeed delimited, it will be inserted as consecutive lines.

See Also

DeleteLines method, Lines method.

Example

The following example uses the InsertLines method to insert a line, "Option Explicit," in the specified code pane.

Application.VBE.CodePanes(1).CodeModule.InsertLines 1, "Option Explicit"