VbaModuleCollection.Add method

Adds a module to the collection.

public void Add(VbaModule vbaModule)


Shows how to create a VBA project using macros.

Document doc = new Document();

// Create a new VBA project.
VbaProject project = new VbaProject();
project.Name = "Aspose.Project";
doc.VbaProject = project;

// Create a new module and specify a macro source code.
VbaModule module = new VbaModule();
module.Name = "Aspose.Module";
module.Type = VbaModuleType.ProceduralModule;
module.SourceCode = "New source code";

// Add the module to the VBA project.

doc.Save(ArtifactsDir + "VbaProject.CreateVBAMacros.docm");

See Also