Add Method (Modules Collection)

Applies To

Modules Collection.

Description

Creates a new Visual Basic module. Returns a Module object.

Syntax

object.Add(before, after, count)

object

Required. The Modules object.

before

Optional. Specifies the sheet before which the new module is added.

after

Optional. Specifies the sheet after which the new module is added.

count

Optional. The number of sheets to add. If omitted, the default is one.

Remarks

If before and after are omitted, the module is inserted before the active sheet.

Example

This example inserts a new Visual Basic module before the active sheet.


ActiveWorkbook.Modules.Add