VbaProject Class
Provides access to VBA project information. A VBA project inside the document is defined as a collection of VBA modules.
Inheritance Hierarchy
SystemObject
  Aspose.WordsVbaProject

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class VbaProject

The VbaProject type exposes the following members.

Constructors
  NameDescription
Public methodVbaProject
Creates a blank VbaProject.
Properties
  NameDescription
Public propertyCodePage
Returns the VBA project’s code page.
Public propertyCode exampleModules
Returns collection of VBA project modules.
Public propertyCode exampleName
Gets or sets VBA project name.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to get access to VBA project information in the document.
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