Please, can you tell me is it possible to extract VBA code from Excel files with Aspose.Cells .NET?
Thank you,
Alen
Please, can you tell me is it possible to extract VBA code from Excel files with Aspose.Cells .NET?
Thank you,
Alen
Hi Alen,
Hi,
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?
We are pleased to inform you that the library (Aspose.Cells for .NET) now supports to create, manipulate or remove vba codes/macros feature(s) with lots of enhancements. Now you have number of ways to do the task for your requirements:
Option 1:
Call Workbook.RemoveMacro()
method to remove the macros and vba codes in the Excel file.
Option 2:
Remove VBA modules in the spreadsheet, please use the following sample code:
for (int i = vbaModuleCollection.getCount() - 1; i >= 0; i--) {
vbaModuleCollection.removeAt(i);
System.out.println("Removed " + i+1);
}
Option 3:
Exclude VBA codes/macros while loading the file into Aspose.Cells object model, see the sample code segment for your reference:
e.g
Sample code:
//Import everything except VBA codes/macros.
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);
.........
We recommend you see the documents in the section on how to manage/manipulate VBA code and macros via Aspose.Cells APIs:
Manipulate Macros or VBA Codes
You can download the latest demos here.