Aspose::Cells::Vba::VbaModuleCollection class

VbaModuleCollection class

Represents the list of VbaModule

class VbaModuleCollection

Methods

MethodDescription
Add(const Worksheet& sheet)Adds module for a worksheet.
Add(VbaModuleType type, const U16String& name)Adds module.
Add(VbaModuleType type, const char16_t* name)Adds module.
AddDesignerStorage(const U16String& name, const Vector <uint8_t>& data)
AddDesignerStorage(const char16_t* name, const Vector <uint8_t>& data)
AddUserForm(const U16String& name, const U16String& codes, const Vector <uint8_t>& designerStorage)Inser user form into VBA Project.
AddUserForm(const char16_t* name, const char16_t* codes, const Vector <uint8_t>& designerStorage)Inser user form into VBA Project.
Get(int32_t index)Gets VbaModule in the list by the index.
Get(const U16String& name)Gets VbaModule in the list by the name.
Get(const char16_t* name)Gets VbaModule in the list by the name.
GetCount()
GetDesignerStorage(const U16String& name)Represents the data of Designer.
GetDesignerStorage(const char16_t* name)Represents the data of Designer.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const VbaModuleCollection& src)operator=
Remove(const Worksheet& sheet)Removes module for a worksheet.
Remove(const U16String& name)Remove the module by the name.
Remove(const char16_t* name)Remove the module by the name.
VbaModuleCollection(VbaModuleCollection_Impl* impl)Constructs from an implementation object.
VbaModuleCollection(const VbaModuleCollection& src)Copy constructor.
~VbaModuleCollection()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
// Init VBA project.
VbaProject vbaProject = workbook.GetVbaProject();
// Add a new module.
vbaProject.GetModules().Add(VbaModuleType::Class, u"test");
//Saving the Excel file
workbook.Save(u"book1.xlsm");

Aspose::Cells::Cleanup();

See Also