InsertText Method

InsertText Method

See Also         Example         Applies To

The InsertText method inserts a specified string of text into a standard module or a class module.

Syntax

object.InsertText text

The InsertText method has the following arguments.

Argument Description
object A Module object.
text The text to be inserted into the module.

Remarks

When you insert a string by using the InsertText method, Microsoft Access places the new text at the end of the module, after all other procedures.

To add multiple lines, include the intrinsic constant vbCrLf at the desired line breaks within the string that makes up the text argument. This constant forces a carriage return and line feed.

To specify at which line the text is inserted, use the InsertLines method. To insert code into the Declarations section of the module, use the InsertLines method rather than the InsertText method.

Note   In previous versions of Microsoft Access, the InsertText method was a method of the Application object. You can still use the InsertText method of the Application object, but it's recommended that you use the InsertText method of the Module object instead.