VbaModuleType enumeration

VbaModuleType enumeration

Specifies the type of a model in a VBA project.

Members

NameDescription
DOCUMENT_MODULEA type of VBA project item that specifies a module for embedded macros and programmatic access operations that are associated with a document.
PROCEDURAL_MODULEA collection of subroutines and functions.
CLASS_MODULEA module that contains the definition for a new object. Each instance of a class creates a new object, and procedures that are defined in the module become properties and methods of the object.
DESIGNER_MODULEA VBA module that extends the methods and properties of an ActiveX control that has been registered with the project.

Examples

Shows how to create a VBA project using macros.

doc = aw.Document()
# Create a new VBA project.
project = aw.vba.VbaProject()
project.name = 'Aspose.Project'
doc.vba_project = project
# Create a new module and specify a macro source code.
module = aw.vba.VbaModule()
module.name = 'Aspose.Module'
module.type = aw.vba.VbaModuleType.PROCEDURAL_MODULE
module.source_code = 'New source code'
# Add the module to the VBA project.
doc.vba_project.modules.add(module)
doc.save(file_name=ARTIFACTS_DIR + 'VbaProject.CreateVBAMacros.docm')

See Also