Lesen von VBA -Informationen aus der MPP -Datei
Aspose.Tasks für .NET API unterstützt das Lesen von VBA -Informationen aus der MPP -Datei. Dies beinhaltet die Arbeit mit:
VBA -Informationen.
Modulinformationen, die im Projekt enthalten sind.
Referenzen Informationen, die im Projekt gespeichert sind.
The following example shows how to read VBA Project Information with the help of VbaProject and Project class.
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);