com.aspose.words

Class VbaModule

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

Provides access to VBA project module.

Example:

Shows how to get access to VBA project information in the document.
Document doc = new Document(getMyDir() + "Document.TestButton.docm");

// A VBA project inside the document is defined as a collection of VBA modules
VbaProject vbaProject = doc.getVbaProject();


VbaModuleCollection vbaModules = doc.getVbaProject().getModules();
for (VbaModule module : vbaModules) {
    System.out.println(MessageFormat.format("Module name: {0};\nModule code:\n{1}\n", module.getName(), module.getSourceCode()));
}

Property Getters/Setters Summary
java.lang.StringgetName()
Returns VBA project module name.
java.lang.StringgetSourceCode()
Returns VBA project module source code.
 

    • Property Getters/Setters Detail

      • getName

        public java.lang.String getName()
        
        Returns VBA project module name.

        Example:

        Shows how to get access to VBA project information in the document.
        Document doc = new Document(getMyDir() + "Document.TestButton.docm");
        
        // A VBA project inside the document is defined as a collection of VBA modules
        VbaProject vbaProject = doc.getVbaProject();
        
        
        VbaModuleCollection vbaModules = doc.getVbaProject().getModules();
        for (VbaModule module : vbaModules) {
            System.out.println(MessageFormat.format("Module name: {0};\nModule code:\n{1}\n", module.getName(), module.getSourceCode()));
        }
      • getSourceCode

        public java.lang.String getSourceCode()
        
        Returns VBA project module source code.

        Example:

        Shows how to get access to VBA project information in the document.
        Document doc = new Document(getMyDir() + "Document.TestButton.docm");
        
        // A VBA project inside the document is defined as a collection of VBA modules
        VbaProject vbaProject = doc.getVbaProject();
        
        
        VbaModuleCollection vbaModules = doc.getVbaProject().getModules();
        for (VbaModule module : vbaModules) {
            System.out.println(MessageFormat.format("Module name: {0};\nModule code:\n{1}\n", module.getName(), module.getSourceCode()));
        }