Question

I want to create new excel sheet with .xlsm extension by using softartisan dll, however in create method of softartisan does not have xlsm format. It has only .xls and .xlsx formats. My new excel contains macros hence I need .xlsm format.

Code is as follows

Dim xla As New ExcelApplication
errWb = xla.Create(FileFormat.Xls) ''Or errWb = xla.Create(FileFormat.Xlsx)

I want file in .Xlsm format If anybody knows please suggest.

Was it helpful?

Solution

OfficeWriter does not support manipulating or creating Excel macros/VBA through the API because of the potential security risks. Creating a new XLSM file that doesn't contain any macros has limited usefulness. Hence the XLS and XLSX are the only file formats that can be created from scratch using OfficeWriter.

OfficeWriter does support manipulating existing XLSM files, but the macros/VBA are not accessible. If you need to create a new report that contains certain macros, we recommend that you create an XLSM file in Excel that contains the macros that you need. Then open and modify that file with ExcelApplication. The XLSM file can event be blank, except for the macros that you need.

Dim xla As ExcelApplication = new ExcelApplication()
Dim wb As Workbook = xla.Open("myStartingTemplate.xlsm")
...

Note: I work for SoftArtisans, makers of OfficeWriter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top