Aspose::Words::Vba::VbaModule::get_Type method

VbaModule::get_Type method

Specifies whether the module is a procedural module, document module, class module, or designer module.

Aspose::Words::Vba::VbaModuleType Aspose::Words::Vba::VbaModule::get_Type() const

Examples

Shows how to create a VBA project using macros.

auto doc = MakeObject<Document>();

// Create a new VBA project.
auto project = MakeObject<VbaProject>();
project->set_Name(u"Aspose.Project");
doc->set_VbaProject(project);

// Create a new module and specify a macro source code.
auto module_ = MakeObject<VbaModule>();
module_->set_Name(u"Aspose.Module");
module_->set_Type(VbaModuleType::ProceduralModule);
module_->set_SourceCode(u"New source code");

// Add the module to the VBA project.
doc->get_VbaProject()->get_Modules()->Add(module_);

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

See Also