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

Free Support Forum - aspose.com

Remove macros from MS Excel spreadsheets

Am i able to remove all macros in XLT document created with MS Excel?

We don't provide this feature because we are not very sure about content of macros so we have to preserve them. Removing them may cause problems.

However, in the next version of Aspose.Cells, we will add a new method to allow you only load data and formattings from Excel file. This method will stripe out all macros. However, it will also remove charts, images and other content and settings.


We recommend you kindly upgrade to and try our newer versions (Aspose.Cells v20.7 (latest). You can exclude macros/vba codes when loading the template file. Also, you can use Workbook.RemoveMacro() method to delete macros and vba codes.
Example 1

var loadFilter = new LoadFilter(LoadDataFilterOptions.All & ~LoadDataFilterOptions.VBA);
                var asposeOptions = new Aspose.Cells.LoadOptions { LoadFilter = loadFilter };
                var wb = new Workbook("e:\\test2\\Book1.xlsx", asposeOptions);

Example 2

    for (int i = vbaModuleCollection.getCount() - 1; i >= 0; i--) {
    System.out.println("Removed " + i+1);

For more information on how to use different features via Aspose.Cells APIs, please follow the link below for Aspose.Cells Documenation:
Aspose.Cells for .NET Documentation

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)