CodeModule Object

Description

Represents the code behind a component, such as a form, class, or document.

Remarks

You use the CodeModule object to modify (add, delete, or edit) the code associated with a component.

Each component is associated with one CodeModule object. However, a CodeModule object can be associated with multiple code panes.

The methods associated with the CodeModule object enable you to manipulate and return information about the code text on a line-by-line basis. For example, you can use the AddFromString method to add text to the module. AddFromString places the text just above the first procedure in the module or places the text at the end of the module if there are no procedures.

Use the Parent property to return the VBComponent object associated with a code module.

Properties

CountOfDeclarationLines property, CountOfLines property, Parent property, VBE property.

Methods

AddFromFile method, AddFromString method, CreateEventProc method, DeleteLines method, Find method, InsertLines method, Lines method, ProcBodyLine method, ProcCountLines method, ProcOfLine method, ProcStartLine method, ReplaceLine method.

See Also

CodePane object, CodePanes collection, VBComponent object, VBComponents collection.