VbaModuleType Enumeration

Specifies the type of a model in a VBA project.

Namespace:  Aspose.Words.Vba
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.11.0

ExpandedSyntax

public enum VbaModuleType

ExpandedMembers

  Member nameValueDescription
DocumentModule0 A type of VBA project item that specifies a module for embedded macros and programmatic access operations that are associated with a document.
ProceduralModule1 A collection of subroutines and functions.
ClassModule2 A 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.
DesignerModule3 A VBA module that extends the methods and properties of an ActiveX control that has been registered with the project.

ExpandedExamples

Shows how to create a VBA project using macros.
Document doc = new Document();

// Create a new VBA project.
VbaProject project = new VbaProject();
project.Name = "Aspose.Project";
doc.VbaProject = project;

// Create a new module and specify a macro source code.
VbaModule module = new VbaModule();
module.Name = "Aspose.Module";
module.Type = VbaModuleType.ProceduralModule;
module.SourceCode = "New source code";

// Add the module to the VBA project.
doc.VbaProject.Modules.Add(module);

doc.Save(ArtifactsDir + "VbaProject.CreateVBAMacros.docm");

ExpandedSee Also