Most "best Excel converter" roundups ignore macros entirely. They rank tools on UI, speed, and format range — all useful signals — but skip the dimension that matters most to developers and power users: whether your VBA code survives the conversion.
This roundup is different. Every tool below was evaluated on three macro-specific tests: 1. XLSM to PDF conversion — does VBA code survive? 2. XLSM to XLSX conversion — does macro code round-trip correctly? 3. XLAM to XLS conversion — does an add-in's module structure survive?
The results are not what the marketing says.
| Rank | Tool | Best For | Macro Preservation | Starting Price | |------|------|----------|-------------------|---------------| | 1 | COM Automation (Excel + Python) | Developers, Windows environments | Full — native fidelity | Free (requires Office license) | | 2 | Aspose.Cells | Enterprise / .NET / Java applications | Full — documented API | $1,499/developer | | 3 | LibreOffice + VBA Module Extractor | Self-hosted SaaS builders | Partial — extractable | Free (open source) | | 4 | CloudConvert API | Volume conversion, format breadth | None — macros dropped | $9.00 (500 credits) | | 5 | Smallpdf Pro | PDF-focused workflows, privacy | None — macros dropped | $12/month | | 6 | ILovePDF | Budget conversion, high free tier | None — macros dropped | Free / $4/month |
What it is: Driving Microsoft Excel itself via Windows Component Object Model (COM), using Python libraries like xlwings or win32com.client.
How macro preservation works: COM automation doesn't convert files in the SaaS sense — it instructs a real Excel instance to open the file and perform operations. Because Excel is the execution environment, macro code is not touched, not parsed, not re-encoded. It stays intact in the output format if the output format supports it (XLSM, XLSB, XLAM), or is explicitly preserved as a .bas export if converting to a non-macro format.
import win32com.client
import os
excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = False
wb = excel.Workbooks.Open(r"C:\files\report.xlsm")
Export VBA modules before conversion
for component in wb.VBProject.VBComponents:
if component.Type in [1, 2, 3]: # Standard, Class, UserForm
component.Export(rf"C:\backup\{component.Name}.bas")
Save as PDF
wb.ExportAsFixedFormat(0, r"C:\output\report.pdf")
wb.Close(False)
excel.Quit()
Limitations:
Cost: Free if you have Office licenses. The server/infrastructure cost is the real expense.
What it is: A commercial .NET/Java library from Aspose that implements its own Office file format parser — no dependency on Microsoft Office or LibreOffice.
How macro preservation works: Aspose parses the OOXML format directly, including the VBA project storage embedded within the file container. Because it implements the format spec rather than relying on an application to open the file, it can read, manipulate, and re-write macro code with documented API methods.
// Aspose.Cells - XLSM to XLSM with macro intact
Workbook workbook = new Workbook("input.xlsm");
// VBA project is accessible
VbaProject vbaProject = workbook.VbaProject;
foreach (VbaModule module in vbaProject.Modules)
{
Console.WriteLine($"Module: {module.Name}");
Console.WriteLine(module.Codes); // Full VBA source
}
// Save with macros preserved
workbook.Save("output.xlsm", SaveFormat.Xlsm);
For cross-format conversion (XLSM to PDF), Aspose renders the visible content to PDF and can optionally export VBA modules as separate files for preservation.
Limitations:
Cost: $1,499/developer + $600/year maintenance.
What it is: Running LibreOffice without a GUI on a Linux server, combined with custom code to extract VBA modules before conversion and optionally re-embed them.
How partial macro preservation works:
LibreOffice opens XLSM/DOCM files and can convert them to other formats. It does not preserve macros across format conversions. However, the XLSM format is a ZIP container — you can unzip it, extract the vbaProject.bin binary, convert the document to XLSX with LibreOffice, and then use a library like oletools or olevba to parse the VBA binary and export module source.
This is a two-step extraction, not true preservation: you end up with the converted file (macros stripped) plus the VBA source code in separate .bas files. Whether that's acceptable depends on the use case.
Extract VBA source from an XLSM
cp report.xlsm report.zip
unzip report.zip -d extracted/
python3 -m olevba extracted/xl/vbaProject.bin > macros.txt
Convert the document
libreoffice --headless --convert-to xlsx report.xlsm --outdir output/
Limitations:
olevba parses the VBA binary format, but obfuscated macros, P-code-only modules, and certain ActiveX components are not reliably extracted.Cost: Free. Infrastructure is the only cost.
The tools below are excellent for standard Office-to-PDF and format conversions. They are listed here because they appear in "best converter" searches and their macro handling needs to be stated explicitly.
The developer-friendly option with the best API. Fast, reliable, broad format support. Transparent credit-based pricing. Detailed comparison: CloudConvert vs Zamzar.
Macro verdict: Dropped silently on all cross-format conversions. No configuration option.
Best for: High-volume API-based conversions where macro content is not part of the deliverable. Bulk XLSX → PDF, CSV exports, document format normalization.
Pricing: $9 for 500 credits (pay-as-you-go) or $15.20/month subscription.
Best consumer UX with genuine privacy credentials. Swiss servers, 1-hour file deletion, SOC 2. Good e-signature and annotation tools. Detailed comparison: Smallpdf vs ILovePDF.
Macro verdict: Dropped. LibreOffice-based conversion pipeline.
Best for: PDF workflows with privacy requirements. Non-technical users converting standard documents.
Pricing: $12/month Pro.
Best free tier in the consumer segment: unlimited conversions, 100MB file size. Cheapest paid option at $4/month Basic. Adequate API for light integration.
Macro verdict: Dropped. Same LibreOffice pipeline as Smallpdf.
Best for: Budget-conscious users who need volume without paying. Batch PDF conversion without macro requirements.
Pricing: Free with ads / $4/month Basic.
There is a clean split in this market:
Tools 1-3 (COM, Aspose, LibreOffice+extractor) all require technical implementation. None of them are "upload a file and download the result" products. They are libraries, automation scripts, or local installations. The expertise required to deploy them is real.
Tools 4-6 (CloudConvert, Smallpdf, ILovePDF) are the SaaS products that non-technical users find and pay for. They handle 99% of conversion use cases well. They completely fail at macro preservation, and they do not document this failure.
This creates a market gap: there is no consumer-facing, SaaS-priced product that handles macro-containing Excel files with fidelity. The users who need this capability either use COM automation (enterprise IT, not accessible to indie developers) or pay for Aspose (too expensive for one-off use).
The gap has a specific search demand. Keywords like "excel converter keep macros," "xlsm converter with vba," and "convert excel without losing macros" collectively see thousands of searches per month with weak competition — most SERP results are Stack Overflow threads and generic converter comparison posts that don't actually solve the problem.
This is the niche the Macro-Safe Converter Research Kit was built to serve. The kit documents the competitive gap, the keyword matrix, the technical implementation patterns for all three viable approaches, and the pricing model for a converter product that can charge $7-12/month by solving what no free tool offers. The analysis is done; the market is validated.
If you're converting files as an end user:
Is there any free online tool that preserves Excel macros? No. As of 2026, no free consumer converter (Smallpdf, ILovePDF, CloudConvert free tier, Zamzar, OnlineConvertFree) preserves VBA macros across format conversions. The technical barrier — executing or faithfully re-encoding VBA at scale — has not been solved in the consumer tier.
Can LibreOffice preserve macros when converting? LibreOffice preserves macros when the output format supports them (e.g., ODS with Basic macros). For XLSM to PDF or XLSM to XLSX conversion, the VBA code is dropped. LibreOffice does not implement Microsoft's VBA runtime and cannot guarantee fidelity for complex macro operations.
What's the cheapest way to get macro preservation?
COM automation via xlwings or win32com is free if you have an Office license. This is Windows-only and requires a licensed Excel installation on the machine running the conversion.
Is Aspose.Cells worth the price? For a commercial product where macro fidelity is a paid feature, yes. At $1,499/developer, it prices itself out of personal projects but is reasonable for a SaaS charging $10-20/month to business users with complex Excel automation files.
What keyword should I target if I'm building a macro-safe converter? "Excel converter keep macros" and "xlsm to pdf keep macros" have the best traffic-to-competition ratio based on current SERP analysis. The full 20-keyword matrix is in the Macro-Safe Converter Research Kit.
Macro-Safe Converter preserves VBA macros through XLSM conversions. One-time kit — no subscription.
Get the Kit — $9 one-time →