AddModule Method


Adds a MacroModule to the application or document.

Namespace: Autodesk.Revit.DB.Macros
Assembly: RevitAPIMacros (in RevitAPIMacros.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2014

Syntax

C#
public MacroModule AddModule(
	ModuleSettings moduleSettings
)
Visual Basic
Public Function AddModule ( _
	moduleSettings As ModuleSettings _
) As MacroModule
Visual C++
public:
MacroModule^ AddModule(
	ModuleSettings^ moduleSettings
)

Parameters

moduleSettings
Type: Autodesk.Revit.DB.Macros ModuleSettings
The module settings.

Return Value

The new module.

Remarks

Note: document-level modules will not be saved to the document until the document is saved. Thus this operation is not undoable and does not require an open transaction even for document-level modules.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Thrown when the module name is duplicated with the existing one, or the name is too long, or the name contains invalid identifier(s), such as include "#", "%", ... and key words in C# or VB.NET.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL

See Also