java.lang.Object
com.aspose.words.VbaProject
- All Implemented Interfaces:
- java.lang.Cloneable
public class VbaProject
- extends java.lang.Object
Provides access to VBA project information.
A VBA project inside the document is defined as a collection of VBA modules.
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()));
}
// Set new source code for VBA module
String oldCode = vbaModules.get(0).getSourceCode();
vbaModules.get(0).setSourceCode("Your VBA code...");
vbaModules.get(0).setSourceCode(oldCode);
|
Constructor Summary |
VbaProject()
Creates a blank VbaProject.
|
|
Property Getters/Setters Summary |
int | getCodePage() | |
|
Returns the VBA project’s code page.
|
boolean | isSigned() | |
|
Shows whether the VbaProject is signed or not.
|
VbaModuleCollection | getModules() | |
|
Returns collection of VBA project modules.
|
java.lang.String | getName() | |
void | setName(java.lang.String value) | |
|
Gets or sets VBA project name.
|
VbaProject
public VbaProject()
-
Creates a blank VbaProject.
|
Property Getters/Setters Detail |
getCodePage | |
public int getCodePage()
|
-
Returns the VBA project’s code page.
isSigned | |
public boolean isSigned()
|
-
Shows whether the VbaProject is signed or not.
-
Returns collection of VBA project modules.
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()));
}
// Set new source code for VBA module
String oldCode = vbaModules.get(0).getSourceCode();
vbaModules.get(0).setSourceCode("Your VBA code...");
vbaModules.get(0).setSourceCode(oldCode);
getName/setName | |
public java.lang.String getName() / public void setName(java.lang.String value)
|
-
Gets or sets VBA project 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()));
}
// Set new source code for VBA module
String oldCode = vbaModules.get(0).getSourceCode();
vbaModules.get(0).setSourceCode("Your VBA code...");
vbaModules.get(0).setSourceCode(oldCode);
-
Performs a copy of the VbaProject.
- Returns:
- The cloned VbaProject.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.