VbaModule Class
Provides access to VBA project module.
Inheritance Hierarchy
SystemObject
  Aspose.WordsVbaModule

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class VbaModule

The VbaModule type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleName
Returns VBA project module name.
Public propertyCode exampleSourceCode
Gets or sets VBA project module source code.
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
Shows how to get access to VBA project information in the document.
[C#]

Document doc = new Document(MyDir + "Document.TestButton.docm");

// A VBA project inside the document is defined as a collection of VBA modules
VbaProject vbaProject = doc.VbaProject;
Console.WriteLine($"Project name: {vbaProject.Name}; Modules count: {vbaProject.Modules.Count()}\n");


VbaModuleCollection vbaModules = doc.VbaProject.Modules;
foreach (VbaModule module in vbaModules)
{
    Console.WriteLine($"Module name: {module.Name};\nModule code:\n{module.SourceCode}\n");
}
See Also