문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top