IronXL supports macros in Excel. Simply load, edit and save an XSLM document - and macros will not be edited or disabled.
XLSX files may be saved as XLSM file extension to enable macros.
To disable macros, simply save an XSLM with the XLSX file extension.
C#:
using IronXL;
WorkBook workbook = WorkBook.Load("test.xlsm");
//You can load xlsm file and work with it as you wish.
var sheet = workbook.CreateWorkSheet("one more sheet");
sheet["A1:B2"].Value = "Hi";
//Then you can save it with xlsm extension and all macros will be preserved.
workbook.SaveAs("test.edit.xlsm");
VB:
Imports IronXL
Private workbook As WorkBook = WorkBook.Load("test.xlsm")
'You can load xlsm file and work with it as you wish.
Private sheet = workbook.CreateWorkSheet("one more sheet")
Private sheet("A1:B2").Value = "Hi"
'Then you can save it with xlsm extension and all macros will be preserved.
workbook.SaveAs("test.edit.xlsm")
Top comments (0)