Adds a MacroModule to the application or document.

Namespace: Autodesk.Revit.UI.Macros
Assembly: RevitAPIUIMacros (in RevitAPIUIMacros.dll) Version: 21.0.0.0 (21.1.1.109)
Since:  2014

Syntax

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

Parameters

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

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

ExceptionCondition
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
Autodesk.Revit.Exceptions..::..ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration

See Also