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");
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")