asposediagram.api

Class VbaProject

Represents the VBA project.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");

diagram = new aspose.diagram.Diagram("Macro.vsdm");
// extract VBA project
v = diagram.getVbaProject();
// Iterate through the modules and modify VBA macro code
for (i = 0; i < diagram.getVbaProject().getModules().getCount(); i++) {
    module = diagram.getVbaProject().getModules().get(i);
    code = module.getCodes();
    if (code.indexOf("This is test message.") != -1) {
        code = code.replace("This is test message.", "This is Aspose.Diagram message.");
    }
    module.setCodes(code);
}
// save the Visio diagram
diagram.save("out-ModifyVBAModule.vssm", aspose.diagram.SaveFileFormat.VSSM);

Property Getters/Setters Summary
methodisProtected()
Indicates whether this VBA project is protected.
methodisSigned()
Indicates whether VBAcode is signed or not.
methodgetModules()
Gets all VbaModule objects.
methodgetName()
method
setName(value)
           Gets and sets the name of the VBA project.
methodgetReferences()
Gets all references of VBA project.
 
Method Summary
methodprotect(islockedForViewing, password)
Protects or unprotects this VBA project.
methodvalidatePassword(password)
Validates protection password.
 

    • Property Getters/Setters Detail

      • getName/setName : String 

        String getName() / setName(value)
        
        Gets and sets the name of the VBA project.
      • isSigned : boolean 

        boolean isSigned()
        
        Indicates whether VBAcode is signed or not.
      • isProtected : boolean 

        boolean isProtected()
        
        Indicates whether this VBA project is protected.
    • Method Detail

      • protect

         protect(islockedForViewing, password)
        Protects or unprotects this VBA project. If islockedForViewing is true, the password could not be null.
        Parameters:
        islockedForViewing: boolean - indicates whether locks project for viewing.
        password: String - If the value is null, unprotects this VBA project, otherwise protect this VBA project.
      • validatePassword

        boolean validatePassword(password)
        Validates protection password.
        Parameters:
        password: String - the password
        Returns:
        Whether password is the protection password of this VBA project