com.aspose.words

Class VbaModuleType

  • java.lang.Object
    • com.aspose.words.VbaModuleType
public class VbaModuleType 
extends java.lang.Object

Utility class containing constants. Specifies the type of a model in a VBA project.

Example:

Shows how to create a VbaProject from a scratch for using macros.
Document doc = new Document();

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

// Create a new module and specify a macro source code
VbaModule module = new VbaModule();
module.setName("Aspose.Module");
// VbaModuleType values:
// procedural module - A collection of subroutines and functions
// ------
// document module - A type of VBA project item that specifies a module for embedded macros and programmatic access
// operations that are associated with a document
// ------
// class module - 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
// ------
// designer module - A VBA module that extends the methods and properties of an ActiveX control that has been
// registered with the project
module.setType(VbaModuleType.PROCEDURAL_MODULE);
module.setSourceCode("New source code");

// Add module to the VBA project
doc.getVbaProject().getModules().add(module);

doc.save(getArtifactsDir() + "Document.CreateVBAMacros.docm");

Field Summary
static final intDOCUMENT_MODULE = 0
A type of VBA project item that specifies a module for embedded macros and programmatic access operations that are associated with a document.
static final intPROCEDURAL_MODULE = 1
A collection of subroutines and functions.
static final intCLASS_MODULE = 2
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.
static final intDESIGNER_MODULE = 3
A VBA module that extends the methods and properties of an ActiveX control that has been registered with the project.
 

    • Field Detail

      • DOCUMENT_MODULE = 0

        public static final int DOCUMENT_MODULE
        A type of VBA project item that specifies a module for embedded macros and programmatic access operations that are associated with a document.
      • PROCEDURAL_MODULE = 1

        public static final int PROCEDURAL_MODULE
        A collection of subroutines and functions.
      • CLASS_MODULE = 2

        public static final int CLASS_MODULE
        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.
      • DESIGNER_MODULE = 3

        public static final int DESIGNER_MODULE
        A VBA module that extends the methods and properties of an ActiveX control that has been registered with the project.