Project Format
Understand the .vbapadlock folder structure.
You manage multiple VBA Padlock projects and want to automate the build process. This guide shows you how to compile projects from the command line, integrate with batch scripts, and set up CI/CD pipelines.
What you’ll learn:
Time needed: 15 minutes
VBAPadlock.exe "<office-file>" [switches]The first argument is the path to the Office source file (.xlsm, .docm, .accdb, .pptm, etc.). The associated .vbapadlock project folder must be in the same directory.
| Switch | Type | Description |
|---|---|---|
-c or --compile | Flag | Compile the project and build all DLLs (32-bit, 64-bit, and satellite). |
-q or --quit | Flag | Quit the application after compilation. |
-s or --silent | Flag | Hide the main window (headless mode). Implies --quit when combined with --compile. |
--publish | Flag | Perform a final/publish build. Disables HotLoading for production distribution. |
--log:<path> | String | Save the compilation log to the specified file path. |
| Exit Code | Constant | Meaning |
|---|---|---|
0 | EXIT_SUCCESS | Compilation completed successfully. All DLLs have been built. |
1 | EXIT_INVALID_ARGUMENTS | Invalid command-line arguments or missing source file path. |
2 | EXIT_FILE_NOT_FOUND | The specified Office source file was not found. |
3 | EXIT_PROJECT_LOAD_ERROR | The project could not be loaded (missing .vbapadlock folder, corrupt project.xml, etc.). |
4 | EXIT_COMPILE_ERROR | VBA compilation failed (syntax error) or DLL build failed. |
Without any switches, passing just a file path opens the project in VBA Padlock Studio — no compilation is triggered:
VBAPadlock.exe "C:\Projects\MyApp\MyWorkbook.xlsm"Create a batch script that builds one project and checks the result:
@echo offsetlocal
set VBAPADLOCK="C:\Program Files\VBA Padlock\VBAPadlock.exe"set PROJECT="C:\Projects\MyApp\MyWorkbook.xlsm"
echo Building %PROJECT%...%VBAPADLOCK% %PROJECT% --compile --silent --log:build.log
if %ERRORLEVEL% NEQ 0 ( echo BUILD FAILED with exit code %ERRORLEVEL% type build.log exit /b %ERRORLEVEL%)
echo Build successful.endlocalBuild several projects in sequence:
@echo offsetlocal enabledelayedexpansion
set VBAPADLOCK="C:\Program Files\VBA Padlock\VBAPadlock.exe"set PROJECTS_DIR=C:\Projects
set FAILED=0
for %%P in ( "%PROJECTS_DIR%\AppA\Workbook.xlsm" "%PROJECTS_DIR%\AppB\Report.docm" "%PROJECTS_DIR%\AppC\Database.accdb") do ( echo. echo === Building %%~nxP === %VBAPADLOCK% %%P --compile --silent --log:%%~nP_build.log if !ERRORLEVEL! NEQ 0 ( echo FAILED: %%~nxP set /a FAILED+=1 ) else ( echo OK: %%~nxP ))
echo.if %FAILED% GTR 0 ( echo %FAILED% project(s) failed to build. exit /b 1) else ( echo All projects built successfully.)
endlocalAfter building, verify the output DLLs exist:
@echo offset PROJECT_DIR=C:\Projects\MyApp
:: Check all three DLLs existif not exist "%PROJECT_DIR%\bin\MyWorkbookrun32.dll" ( echo ERROR: Missing 32-bit runtime DLL exit /b 1)if not exist "%PROJECT_DIR%\bin\MyWorkbookrun64.dll" ( echo ERROR: Missing 64-bit runtime DLL exit /b 1)if not exist "%PROJECT_DIR%\bin\MyWorkbook.dll" ( echo ERROR: Missing satellite DLL exit /b 1)
echo All build artifacts verified..vbapadlock project folder must be in the repository.bin\ output directory should be in .gitignore.name: Build VBA Padlock Projectson: [push]
jobs: build: runs-on: self-hosted steps: - uses: actions/checkout@v4
- name: Build Project shell: cmd run: | "C:\Program Files\VBA Padlock\VBAPadlock.exe" "%GITHUB_WORKSPACE%\MyWorkbook.xlsm" --compile --silent --publish --log:build.log if %ERRORLEVEL% NEQ 0 ( type build.log exit /b %ERRORLEVEL% )
- name: Upload artifacts uses: actions/upload-artifact@v4 with: name: protected-app path: | MyWorkbook.xlsm bin/
- name: Upload build log if: always() uses: actions/upload-artifact@v4 with: name: build-log path: build.logMyProject/├── MyWorkbook.xlsm ← Office file├── MyWorkbook.vbapadlock/ ← Project folder (commit this)│ ├── project.xml│ ├── Main.bas│ └── Helpers.bas├── build.bat ← Build script├── .gitignore ← Excludes bin/└── bin/ ← Output (generated, do not commit)When --log:<path> is specified, the log file is a plain UTF-8 text file containing all compilation messages. Each line is prefixed with its severity level:
VBA Padlock Compilation Log - 2026-02-12 14:30:00------------------------------------------------------------[Info] Validating project settings...[Info] Compiling scripts...[Info] Built 32-bit runtime DLL: C:\Projects\bin\MyWorkbookrun32.dll[Info] Built 64-bit runtime DLL: C:\Projects\bin\MyWorkbookrun64.dll[Info] Built satellite DLL: C:\Projects\bin\MyWorkbook.dll[Success] Compilation completed successfully.The log file is created in all exit paths — including error scenarios — so it can always be inspected after a build.
.vbapadlock project folder must be in the same directory.dll_templates\ subdirectory (part of the installation)..bas files) must be saved as UTF-8. The compiler reads scripts using UTF-8 encoding. Using a different encoding may cause compilation errors or incorrect string handling.Project Format
Understand the .vbapadlock folder structure.
Protect Excel
Step-by-step project creation.
Troubleshooting
Common build issues and solutions.