We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Access the modules when using OLE


I would like to access the modules when using OLE. I would write : foreach (Excel.Worksheet moduleSheet in _currentWorkBook.Modules) I notice that this was a feature requested back in 2010 has it been incorporated yet. I.e. support to edit vba code in workbook modules


This message was posted using Email2Forum by babar.raza.


Thanks for your question and considering Aspose.Cells for your needs.

Please go through these articles and see if they fulfill your needs.

  1. Managing OLE Objects
  2. Extract Ole Objects from Workbook
  3. Inserting a WAV file as an Ole Object

Actually these articles do not appear to help. perhaps if I were to supply more details. Excel stores its VBA code in modules I wish to be able to extract the VBA code or add protection to the modules. If I was manipulating the modules in excel I would for instance to make the modules read only i.e. the code they contain readonly

foreach (Excel.Worksheet moduleSheet in _currentWorkBook.Modules)



Excel.Range wsCells = (Excel.Range)moduleSheet.Cells;

wsCells.Locked = true;

moduleSheet.Protect(LoggedOnUser.GUID,missing, missing, missing, missing, missing, missing, missing, missing,missing, missing, missing, missing, missing, missing, missing);


How can I achieve this in Aspose cells. There is a related post, dated 4th November 2010, with a reference CELLSNET-21312


Thanks for clarifying the problem.

Aspose.Cells for .NET does not allow the extraction/insertion/modification of VBA code inside the Excel documents.

This feature has not yet been implemented and also there are currently no plans for it in near future.

Anyway, I have also added your request for this feature. Once, we have any update for it, we will let you know asap.

This issue has been assigned as id: CELLSNET-40353


Thanks for using Aspose.Cells.

We only plan to create, manipulate or embed VBA codes/ macros later. We however cannot support to run or execute macros. Does it fit your needs?