MPP 파일에서 VBA 정보를 읽습니다
Contents
[
Hide
Show
]Aspose.Tasks for .NET API는 MPP 파일에서 VBA 정보를 읽는 것을 지원합니다. 여기에는 다음과 같은 작업이 포함됩니다.
VBA 정보.
프로젝트에 포함 된 모듈 정보.
참조 프로젝트에 저장된 정보.
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);