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 | ||
|---|---|---|
method | isProtected() | |
Indicates whether this VBA project is protected.
|
||
method | isSigned() | |
Indicates whether VBAcode is signed or not.
|
||
method | getModules() | |
Gets all |
||
method | getName() | |
method | setName(value) | |
| Gets and sets the name of the VBA project. | ||
method | getReferences() | |
Gets all references of VBA project.
|
||
| Method Summary | ||
|---|---|---|
method | protect(islockedForViewing, password) | |
Protects or unprotects this VBA project.
|
||
method | validatePassword(password) | |
Validates protection password.
|
||
String getName() / setName(value)
boolean isSigned()
boolean isProtected()
VbaModuleCollection getModules()
VbaProjectReferenceCollection getReferences()
protect(islockedForViewing, password)
islockedForViewing: boolean - indicates whether locks project for viewing.password: String -
If the value is null, unprotects this VBA project, otherwise protect this VBA project.
boolean validatePassword(password)
password: String - the password