Reading VBA Information from MPP File

Aspose.Tasks for .NET API provides support for reading VBA information from the MPP file. This includes working with:

The following example shows how to read VBA Project Information with the help of VbaProject and Project class.

1Project project = new Project("New Project.mpp");
2VbaProject vbaProject = project.VbaProject;
3Console.WriteLine("VbaProject.Name " + vbaProject.Name);
4Console.WriteLine("VbaProject.Description " + vbaProject.Description);
5Console.WriteLine("VbaProject.CompilationArguments " + vbaProject.CompilationArguments);
6Console.WriteLine("VbaProject.HelpContextId " + vbaProject.HelpContextId);

The following example shows how to read VBA References Information from VBA with the help of VbaProject, Project and VbaReference class

 1Project project = new Project("New Project.mpp");
 2
 3VbaProject vbaProject = project.VbaProject;
 4VbaReferenceCollection references = vbaProject.References;
 5Console.WriteLine("Reference count ", references.Count);
 6
 7VbaReference reference = vbaProject.References.ToList()[0];
 8Console.WriteLine("Identifier: " + reference.LibIdentifier);
 9Console.WriteLine("Name: " + reference.Name);
10
11reference = vbaProject.References.ToList()[1];
12Console.WriteLine("Identifier: " + reference.LibIdentifier);
13Console.WriteLine("Name: " + reference.Name);
14
15reference = vbaProject.References.ToList()[2];
16Console.WriteLine("Identifier: " + reference.LibIdentifier);
17Console.WriteLine("Name: " + reference.Name);

Reading Modules Information from VBA

The following example shows how to read modules information from VBA with the help of VbaProject, Project and IVbaModule class

1Project project = new Project("New Project.mpp");
2
3VbaProject vbaProject = project.VbaProject;
4Console.WriteLine("Total Modules Count: " + vbaProject.Modules.Count);
5
6IVbaModule vbaModule = vbaProject.Modules.ToList()[0];
7Console.WriteLine("Module Name: " + vbaModule.Name);
8Console.WriteLine("Source Code: " + vbaModule.SourceCode);

Reading Module Attributes Information from VBA

The following example shows how to read modules attributes from VBA with the help of VbaProject, Project and IVbaModule class

1Project project = new Project("New Project.mpp");
2VbaProject vbaProject = project.VbaProject;
3IVbaModule vbaModule = vbaProject.Modules.ToList()[0];
4
5Console.WriteLine("Attributes Count: " + vbaModule.Attributes.Count);
6Console.WriteLine("VB_Name: " + vbaModule.Attributes.ToList()[0].Key);
7Console.WriteLine("Module1: " + vbaModule.Attributes.ToList()[0].Value);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.