Aspose::Cells::Vba::VbaModule class
Contents
[
Hide
]VbaModule class
Represents the module in VBA project.
class VbaModule
Methods
| Method | Description |
|---|---|
| GetBinaryCodes() | Gets and sets the binary codes of module. |
| GetCodes() | Gets and sets the codes of module. |
| GetName() | Gets and sets the name of Module. |
| GetType() | Gets the type of module. |
| IsNull() const | Checks whether the implementation object is nullptr. |
| explicit operator bool() const | operator bool() |
| operator=(const VbaModule& src) | operator= |
| SetCodes(const U16String& value) | Gets and sets the codes of module. |
| SetCodes(const char16_t* value) | Gets and sets the codes of module. |
| SetName(const U16String& value) | Gets and sets the name of Module. |
| SetName(const char16_t* value) | Gets and sets the name of Module. |
| VbaModule(VbaModule_Impl* impl) | Constructs from an implementation object. |
| VbaModule(const VbaModule& src) | Copy constructor. |
| ~VbaModule() | Destructor. |
Fields
| Field | Description |
|---|---|
| _impl | The implementation object. |
Examples
Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
// Init VBA project.
VbaProject vbaProject = workbook.GetVbaProject();
// Add a new module.
int index = vbaProject.GetModules().Add(VbaModuleType::Class, u"test");
// Get vba module
VbaModule vbaModule = vbaProject.GetModules().Get(index);
// Set codes
vbaModule.SetCodes(u"Sub ShowMessage()\r\nMsgBox \"Welcome to Aspose!\"\r\nEnd Sub");
//Saving the Excel file
workbook.Save(u"book1.xlsm");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells::Vba
- Library Aspose.Cells for C++