You've been there. You open an XLSM file in CloudConvert, SmallPDF, or any of the dozen other online converters, hit convert, and the output arrives — technically correct, macros missing. Every time.
This isn't a bug. It's a deliberate design decision, and understanding why they do it points you toward what actually works.
Every major online file converter — CloudConvert, ILovePDF, Zamzar, Smallpdf — serves millions of users per month. To do that at scale, they run conversion jobs in sandboxed, isolated environments with no execution layer. Files go in, static outputs come out.
VBA macros are executable code. They can call external APIs, write to disk, open applications, run shell commands. Allowing a converter to "preserve" macros in any meaningful sense would require:
1. Executing untrusted VBA code server-side (catastrophic security risk) 2. Or copying macro bytecode blindly without understanding it (breaks on every Office version mismatch)
Neither is viable at scale. So they strip them. Not lazily — intentionally.
When you search for "keep macros when converting Excel," you're probably asking one of three different questions:
Question 1: You need the macros to still run in the output file. This is only possible if the output format supports macros: XLSM, XLSB, XLAM, or a .bas module export. PDF, XLSX, and CSV cannot run macros — ever. The format physically cannot store executable code.
**Question 2: You're doing a bulk format migration and need macros intact in the new XLSM files.** Totally solvable. Python + COM automation (Windows), or openpyxl for simpler cases. The macros stay because you're not converting away from a macro-capable format.
Question 3: You want a PDF output + the VBA code archived alongside it. Also solvable. Split the operation: generate the PDF, extract the VBA modules to .bas files, store them together. The PDF is static, the code is preserved separately.
Most online converters solve none of these correctly — they handle Question 3 by silently dropping the code and calling it "converted."
Python + win32com (Windows only):
import win32com.client
def convert_batch(input_dir, output_dir):
excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = False
for xlsm in Path(input_dir).glob("*.xlsm"):
wb = excel.Workbooks.Open(str(xlsm))
out = Path(output_dir) / xlsm.name
wb.SaveAs(str(out), FileFormat=52) # 52 = xlsm
wb.Close()
excel.Quit()
This is the only reliable method for keeping macros truly intact across a batch. It uses the actual Excel engine — no conversion, no reinterpretation.
LibreOffice headless (cross-platform):
libreoffice --headless --convert-to pdf *.xlsm --outdir ./pdf_output
Then extract macros with python-pptx / openpyxl:
from zipfile import ZipFile
with ZipFile("file.xlsm") as z:
for name in z.namelist():
if name.startswith("xl/vbaProject"):
z.extract(name, "macro_archive/")
This gives you the PDF and a binary VBA archive. Not runnable, but preserved for compliance or reference.
Here's what's interesting from a market perspective: there's no SaaS tool specifically designed for enterprise macro migration at scale.
The tools that exist are either:
This is the kind of gap worth building into.
If you need to migrate macro-heavy workbooks today:
1. Stay in Excel-native formats (XLSM → XLSM/XLSB) using COM automation 2. Don't trust any online converter to preserve executable code — they won't 3. Archive macros separately if you need a static output (PDF + .bas files) 4. Document the macro inventory first — know what each macro does before migrating, because some will break regardless of the tool
If you're evaluating this as a product niche, or planning a migration project for a large workbook library, I've put together a more detailed kit: keyword research, pricing model, competitive analysis, and a programmatic SEO plan for building in this space.
→ Macro-Safe Converter Launch Kit ($7 — founder research kit, not a tool subscription)
*This article is part of an ongoing series on underserved SaaS niches in file conversion. Next: Why "batch convert DOC to DOCX" is a $0 niche disguised as a $2.5B market.*
Macro-Safe Converter preserves VBA macros through XLSM conversions. One-time kit — no subscription.
Get the Kit — $9 one-time →