Distribution Package Structure
When you compile a VBA project with VBA Padlock, the output consists of three DLL files that work together to run your protected application. Understanding this structure is essential for proper distribution.
The Three DLL Files
Section titled “The Three DLL Files”VBA Padlock generates three DLL files for each compilation:
| File Type | Filename Pattern | Purpose | Signed? | Reusable? |
|---|---|---|---|---|
| 32-bit Runtime | [DLLName]run32.dll | Runtime library for 32-bit Office applications | ✅ Yes (G.D.G. Software) | ❌ Unique per project |
| 64-bit Runtime | [DLLName]run64.dll | Runtime library for 64-bit Office applications | ✅ Yes (G.D.G. Software) | ❌ Unique per project |
| Satellite DLL | [DLLName].dll | Contains your compiled VBA bytecode and project-specific data | Integrity-verified (internal signature) | ❌ Unique per project |
Directory Structure
Section titled “Directory Structure”All DLL files are placed in a bin/ subdirectory relative to your protected Office file.
Example: Excel Application
Section titled “Example: Excel Application”DirectoryMyExcelApp/
- MyExcelApp.xlsm ← Protected workbook (VBA Bridge code only)
Directorybin/
- MyExcelApprun32.dll ← 32-bit runtime (size varies)
- MyExcelApprun64.dll ← 64-bit runtime (size varies)
- MyExcelApp.dll ← Satellite DLL with your compiled code (size varies)
Example: Word Document
Section titled “Example: Word Document”DirectoryMyWordDoc/
- MyWordDoc.docm ← Protected document
Directorybin/
- MyWordDocrun32.dll
- MyWordDocrun64.dll
- MyWordDoc.dll
Example: Access Database
Section titled “Example: Access Database”DirectoryMyAccessDB/
- MyAccessDB.accdb ← Protected database
Directorybin/
- MyAccessDBrun32.dll
- MyAccessDBrun64.dll
- MyAccessDB.dll
How the VBA Bridge Finds the DLLs
Section titled “How the VBA Bridge Finds the DLLs”The VBA Bridge code generated by VBA Padlock uses the Windows AddDllDirectory API to add the bin\ subfolder to the DLL search path. The Declare statements then reference the runtime DLLs by name only (without a path prefix):
' Example: VBA Bridge code (auto-generated)' The VBA Bridge uses AddDllDirectory to set the bin\ path,' then references the runtime DLLs by name only:#If Win64 Then Private Declare PtrSafe Function VBAPLInit Lib "MyExcelApprun64.dll" _ (ByRef ApplicationCallerRef As Variant, ByVal SecurityCode As Long) As Long#Else Private Declare Function VBAPLInit Lib "MyExcelApprun32.dll" _ (ByRef ApplicationCallerRef As Variant, ByVal SecurityCode As Long) As Long#End IfThis means:
- The VBA Bridge calls
AddDllDirectoryto register thebin\folder in the same directory as the Office file - The
Declarestatements use the DLL filename only — Windows finds it via the registered search path - The correct runtime (32-bit or 64-bit) is selected at compile time using
#If Win64 - The runtime then loads your satellite DLL from the same
bin\folder
Digital Signatures and Integrity
Section titled “Digital Signatures and Integrity”The two runtime DLLs are digitally signed by G.D.G. Software using an Authenticode certificate.
Why This Matters
Section titled “Why This Matters”- Windows SmartScreen recognizes the publisher and doesn’t block the files
- Antivirus software is less likely to flag the DLLs as suspicious
- End users can verify the publisher in Windows file properties:
- Right-click DLL → Properties → Digital Signatures tab
- Publisher: G.D.G. Software
- Valid timestamp from a trusted certificate authority
Signature Details (Runtime DLLs)
Section titled “Signature Details (Runtime DLLs)”| Property | Value |
|---|---|
| Publisher | G.D.G. Software |
| Algorithm | SHA-256 with RSA |
| Timestamp | RFC 3161 compliant (survives certificate expiration) |
| Certificate Authority | DigiCert / Sectigo (varies by year) |
Satellite DLL Integrity
Section titled “Satellite DLL Integrity”The satellite DLL is not Authenticode-signed by G.D.G. Software. Instead, its content is verified by an internal cryptographic signature to ensure it has not been tampered with. The runtime checks this signature before loading any compiled code.
Preparing Your Distribution Package
Section titled “Preparing Your Distribution Package”VBA Padlock provides a dedicated Distribution dialog to prepare your files for distribution.
Option 1: Create a ZIP Archive
Section titled “Option 1: Create a ZIP Archive”- Click “Distribute” in the ribbon (Project and Build tab)
- Select “Create ZIP archive”
- Choose a destination for the ZIP file
- VBA Padlock will:
- Copy the protected Office file
- Copy the
bin/folder with all three DLLs - Optionally add README.txt, LICENSE.txt
- Create a ready-to-ship ZIP archive
Result:
MyExcelApp_v1.0.zip (compressed)├── MyExcelApp.xlsm├── bin/│ ├── MyExcelApprun32.dll│ ├── MyExcelApprun64.dll│ └── MyExcelApp.dll├── README.txt (optional)└── LICENSE.txt (optional)If you prefer to create the ZIP manually:
- Navigate to your project’s output folder (usually
[ProjectFolder]\output\) - Select:
- The protected Office file (
.xlsm,.docm,.accdb, etc.) - The entire
bin\folder
- The protected Office file (
- Right-click → Send to → Compressed (zipped) folder
- Rename the ZIP file appropriately (e.g.,
MyExcelApp_v1.0.zip)
Option 2: Copy to a Distribution Folder
Section titled “Option 2: Copy to a Distribution Folder”If you’re creating a custom installer or need to package the files differently:
- Click “Distribute” in the ribbon
- Select “Copy to folder”
- Choose a destination folder
- VBA Padlock copies all necessary files while preserving the directory structure
Result:
C:\Distribution\MyExcelApp\├── MyExcelApp.xlsm└── bin\ ├── MyExcelApprun32.dll ├── MyExcelApprun64.dll └── MyExcelApp.dllYou can then:
- Create an installer with Inno Setup or NSIS
- Upload to a download server
- Burn to a CD/DVD
- Copy to a USB drive
Installation Instructions for End Users
Section titled “Installation Instructions for End Users”Include these instructions with your distribution package:
For ZIP Distribution
Section titled “For ZIP Distribution”INSTALLATION INSTRUCTIONS=========================
1. Download and extract MyExcelApp_v1.0.zip to a folder on your computer (e.g., C:\MyExcelApp\ or your Documents folder)
2. IMPORTANT: Extract ALL files and keep them together. Do not move the 'bin' folder or separate the DLL files from the Excel file.
3. Open MyExcelApp.xlsm in Microsoft Excel
4. If Excel shows a security warning "Macros have been disabled", click "Enable Content"
5. The application will start and may ask for an activation key
6. Enter your activation key when prompted
7. You're ready to use the application!
TROUBLESHOOTING:- If you see "File not found" error: Make sure the 'bin' folder is in the same directory as MyExcelApp.xlsm- If Excel blocks macros: Add the application folder to Excel's Trusted Locations (File > Options > Trust Center > Trusted Locations)For Installer Distribution
Section titled “For Installer Distribution”If you’ve created a proper installer (using Inno Setup, for example), the installation is simpler for users:
- Run the installer (e.g.,
MyExcelApp_Setup.exe) - Follow the installation wizard
- Launch the application from the Start Menu or Desktop shortcut
- Enter your activation key when prompted
The installer handles the directory structure automatically.
Common Mistakes to Avoid
Section titled “Common Mistakes to Avoid”❌ Distributing Only the Satellite DLL
Section titled “❌ Distributing Only the Satellite DLL”Incorrect:
MyExcelApp.xlsmMyExcelApp.dll ← WRONG: Missing runtime DLLsWhy it fails: The satellite DLL depends on the runtime DLLs. Without them, Windows cannot load the library.
Fix: Always include the bin/ folder with all three DLLs.
❌ Moving DLLs Out of the bin/ Folder
Section titled “❌ Moving DLLs Out of the bin/ Folder”Incorrect:
MyExcelApp.xlsmMyExcelApprun32.dll ← WRONG: DLLs should be in bin/MyExcelApprun64.dllMyExcelApp.dllWhy it fails: The VBA Bridge uses AddDllDirectory to register the bin\ subfolder as a DLL search path. If the DLLs are not in bin/, Windows cannot find them.
Fix: Keep the bin/ folder structure intact.
❌ Distributing Only 32-bit or Only 64-bit Runtime
Section titled “❌ Distributing Only 32-bit or Only 64-bit Runtime”Incorrect:
bin/├── MyExcelApprun32.dll ← WRONG: Only 32-bit└── MyExcelApp.dllWhy it fails: Users with 64-bit Office cannot load a 32-bit runtime DLL, and vice versa.
Fix: Always distribute both runtime DLLs. The VBA Bridge will automatically use the correct one.
❌ Renaming the Satellite DLL
Section titled “❌ Renaming the Satellite DLL”Incorrect:
bin/├── MyExcelApprun32.dll├── MyExcelApprun64.dll└── MyApp_Protected.dll ← WRONG: Name must match projectWhy it fails: The VBA Bridge expects the satellite DLL to have the exact name specified in your project settings (usually matching your Office filename).
Fix: Do not rename the satellite DLL after compilation. If you need a different name, change it in VBA Padlock’s Project Info settings and recompile.
Advanced: Network Deployment
Section titled “Advanced: Network Deployment”For enterprise deployments where the Office file and DLLs are stored on a network share:
UNC Path Support
Section titled “UNC Path Support”VBA Padlock DLLs work with UNC paths:
\\server\share\MyExcelApp\MyExcelApp.xlsm\\server\share\MyExcelApp\bin\MyExcelApprun32.dll\\server\share\MyExcelApp\bin\MyExcelApprun64.dll\\server\share\MyExcelApp\bin\MyExcelApp.dllTrusted Locations Configuration
Section titled “Trusted Locations Configuration”Instruct IT administrators to add the network share to Excel’s Trusted Locations:
Via Group Policy (for Active Directory):
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security\Trusted Locations\Location5- Path: \\server\share\MyExcelApp\- AllowSubfolders: 1Via Excel UI (for individual users):
- File → Options → Trust Center → Trust Center Settings
- Trusted Locations → Add new location
- Enter:
\\server\share\MyExcelApp\ - Check “Subfolders of this location are also trusted”
See Also
Section titled “See Also”- Distribution Dialog Reference - Full reference for the Distribution dialog
- Protect an Excel Workbook - Complete tutorial including distribution
- Create an Installer - Building an Inno Setup installer
- Troubleshooting: DLL Load Errors - Fixing common DLL issues