A lightweight desktop tool for copying VBA macros from a source Excel file into one or more target .xlsx files — without requiring Excel to be open.
Built with Python and ttkbootstrap. Available as a standalone .exe executable or as a Python script.
VBA Macro Copier solves a common problem: you have Excel VBA macros in one file and need to apply them to multiple other Excel workbooks. Instead of manually copying macros through Excel's VBA editor (which requires Excel to be running), this tool automates the process by directly manipulating the underlying file structures.
Key advantages:
- No Excel required — Works independently without Microsoft Office
- Batch processing — Apply macros to multiple files at once
- Safe — Original files are never modified; outputs are named with
_newsuffix - Fast — Processes files in seconds
- Simple UI — User-friendly interface with real-time progress logging
- Distribute macros to team members across multiple spreadsheets
- Update legacy workbooks with new functionality
- Automation workflows where you need to inject macros programmatically
- Server/headless environments where Excel is not available
- Bulk macro deployment across large numbers of Excel files
- ✓ Auto-detects
source.xlsmin the same folder as the script - ✓ Select multiple target
.xlsxfiles at once (hold Ctrl in the file picker) - ✓ Outputs
filename_new.xlsmalongside each original file — originals are never modified - ✓ No Excel installation required
- ✓ Color-coded output log per file (success/error status)
- ✓ Preserves original spreadsheet content and formatting
- ✓ Automatically converts
.xlsxto.xlsmformat (macro-enabled)
Download macro_copier.exe from the releases page. No installation required — just run it!
- Place
source.xlsmin the same folder asvba_macro_copier.exe - Run
vba_macro_copier.exe - Follow the on-screen instructions
Requirements:
- Python 3.10 or later
- ttkbootstrap
Install dependency:
pip install ttkbootstrapRun the script:
python macro_copier.py- Place
macro_copier.py(ormacro_copier.exe) andsource.xlsmin the same folder - Run the application
- The Source file field is auto-populated with
source.xlsm. Use Browse… to select a different file if needed. - Click Add files… to select one or more
.xlsxtarget files. Hold Ctrl to select multiple files at once. - Click Copy Macros.
- Output files are saved as
<original_name>_new.xlsmin the same folder as each target file.
.xlsm and .xlsx files are actually ZIP archives containing XML and binary files. VBA macros in Excel are stored as a binary blob (xl/vbaProject.bin) along with metadata in XML files.
VBA Macro Copier performs these steps:
- Extracts the VBA project (
vbaProject.bin) from the source.xlsmfile - Injects it into each target
.xlsxfile - Updates the internal XML metadata to register the macro project:
[Content_Types].xml— Registers the VBA project content typexl/_rels/workbook.xml.rels— Creates relationship link to the macro project
- Saves the result as a valid macro-enabled
.xlsmfile
- Macro dependencies: Ensure your VBA code doesn't reference external libraries or ActiveX controls not available on the target system
- Excel compatibility: The resulting files are fully compatible with Excel 2010 and later
- File size: The output files will be slightly larger due to the added macro project
- Source file requirement: A valid source
.xlsmfile with thevbaProject.binbinary is required
macro-copier/
├── macro_copier.py # Main application source code
├── build.bat # Build script to compile to .exe
├── icon.ico # Application icon
├── source.xlsm # Your macro source file (not included)
├── dist/ # Compiled executable output
├── LICENSE # MIT License with Commons Clause
└── README.md # This file
To compile the Python script into a standalone Windows executable:
build.batThis will use Nuitka to create dist/vba_macro_copier.exe (~12 MB) with full icon support.
- Ensure your source file is a valid
.xlsmfile with macros - The file must be created in Excel (not a converted
.xlsx) - Try opening and re-saving the source file in Excel
- Ensure target
.xlsxfiles are not corrupted - Try with a simple test file first
- Verify that your VBA code is compatible with the target system
- Ensure Windows Defender or antivirus software hasn't quarantined it
- Try running from a different folder
- Check that you have write permissions in the working directory
MIT License with Commons Clause — see LICENSE for details.
This allows use, copying, modification, and redistribution for non-commercial purposes. Commercial use or reselling is not permitted.
Bo Sundgaard, 2026
www.uniteapps.dk