EasyXLS

Macros and VBA project

EasyXLS™ library allows you to export data to Excel files that contains macros or a VBA project. The macro is preserved during the load/write actions.

The Excel macro library also allows reading Excel files macro enabled or removing the macro and VBA project from the Excel file.

EasyXLS doesn't include running an Excel macro.

Write macro to Excel file

EasyXLS™ enables you to write Excel files with macros or VBA project.

The first step is to create an XLSM, XLST, XLS or XLSB file having the macro defined. The macro-enabled Excel file can be empty or already set with sheets and some data.

The second step is to load the XLSM or XLST file using ExcelDocument.easy_LoadXLSXFile method. If the macro is inside an XLS file, ExcelDocument.easy_LoadXLSFile method must be used. If the macro is inside an XLSB file, ExcelDocument.easy_LoadXLSBFile method must be used.

The third step is to add data to Excel file. When the Excel file is completely filled, you can export data to Excel file. For writing an XLSM file, ExcelDocument.easy_WriteXLSXFile method is used, but the exported Excel file must have XLSM file extension. For writing an XLS file macro enabled, ExcelDocument.easy_WriteXLSFile method is used. For writing an XLSB file macro enabled, ExcelDocument.easy_WriteXLSBFile method is used.

If the loaded Excel file contains controls (like button, combo box, check box, list box, so on), the controls are not preserved during the load/write action. The solution is to programmatically create the controls from VBA.

The below example shows how to export data to an XLSM file that includes a VBA project with a possible macro.

C#.NET
VB.NET
C++
Java
PHP
ASP
VB6
VBS
Coldfusion
Python

Read Excel file with macro

EasyXLS™ enables you to read Excel files with macros or VBA project. The macro is preserved when the Excel file is loaded.

In order to load an XLSM or XLST file, ExcelDocument.easy_LoadXLSXFile method must be used. If the macro is inside an XLS file, ExcelDocument.easy_LoadXLSFile method must be used. If the macro is inside an XLSB file, ExcelDocument.easy_LoadXLSBFile method must be used.

Remove macro from Excel file

EasyXLS™ enables you remove the macro or VBA project from the Excel file by using ExcelDocument.easy_removeVBMacros method.

C#.NET
VB.NET
C++
Java
PHP
ASP
VB6
VBS
Coldfusion
Python

Add data into sheets

EasyXLS™ enables you to populate the sheets with data. The supported data types are strings, numbers, dates, booleans, errors and formulas.

Getting started with EasyXLS Excel library

To download the trial version of EasyXLS Excel Library, press the below button:

Download EasyXLS™ Excel Library for .NET and Java

If you already own a license key, you may login and download EasyXLS from your account.



Available for: Professional
Go to top

EasyXLS Excel libraries:

.NET
.NET Excel Library
full .NET version to import, export or convert Excel files
COM+ Excel Library
full COM+ version to import, export or convert Excel files
-
Java
Java Excel Library
full Java version to import, export or convert Excel files
Download EasyXLS™ Excel Library for .NET and Java

File formats:

Office 365
MS Excel 2021 - 2024
MS Excel 2007 - 2019
MS Excel 97 - 2003
XLSXXLSMXLSBXLS
XMLHTMLCSVTXT