type property

VbaModule.type property

Specifies whether the module is a procedural module, document module, class module, or designer module.

def type(self) -> aspose.words.vba.VbaModuleType:

def type(self, value: aspose.words.vba.VbaModuleType):


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.save(ARTIFACTS_DIR + "VbaProject.create_new_vba_project.docm")

See Also