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

Free Support Forum - aspose.com

Aspose.Cells support for macro write/update

Does Aspose.Cells supports VBA macro write/update?
It seems not and I’m wandering if there any workarounds to achieve this. For example, will Worksheet.Copy() Method applying to another file (with macro in it) copy that other file’s macro? API doc says neither ‘yes’ nor ‘not’ on this subject as per below (please consider to update it as it would be beneficial for developers I believe).


public void Copy(
Worksheet sourceSheet


Source worksheet.


You can copy data from another worksheet in the same file or another file. However, this method does not support to copy drawing objects, such as comments, images and charts.

Just to clarify the question above. By ’ … supports VBA macro write/update’ I mean adding or modifying existing Excel spreadsheet’s module and class module (.bas and .cls files).


I am afraid your requested feature of writing/updating macros programmatically through Aspose.Cells is not supported. Aspose.Cells only supports to preserve the macros which are in your template file. It does not support to run, add/update macros or vbas. We have already registered this feature in our internal work list with issue id: CELLSNET-13561. We may look into it in future versions though.

Also, the Worksheet.Copy() method does not copy the macros/vbas in other workbook/file. You should use Workbook.Copy() method instead which does support to copy macros/vbas in other file. We will update the remarks accordingly for the API in the documentation soon.

Thank you.

Thanks for clarification!

Has the status of this request changed?


I am afraid, this is a long pending issue. Also, there are no plans to support running VBA macros in near future.


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?