java.lang.Object
com.aspose.words.VbaModuleCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class VbaModuleCollection
- extends java.lang.Object
Represents a collection of VbaModule objects.
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);
Property Getters/Setters Summary |
int | getCount() | |
|
Returns the number of VBA modules in the collection.
|
VbaModule | get(int index) | |
|
Retrieves a VbaModule object by index.
|
VbaModule | get(java.lang.String name) | |
|
Retrieves a VbaModule object by name, or Null if not found.
|
Method Summary |
void | add(VbaModule vbaModule) | |
Adds a module to the collection.
|
void | remove(VbaModule module) | |
Removes the specified module from the collection.
|
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Returns the number of VBA modules in the collection.
-
Retrieves a VbaModule object by index.
- Parameters:
index
- Zero-based index of the module to retrieve.
get | |
public VbaModule get(java.lang.String name)
|
-
Retrieves a VbaModule object by name, or Null if not found.
-
Adds a module to the collection.
-
Removes the specified module from the collection.
- Parameters:
module
- The module to remove.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.