Skip to content

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.


VBA Padlock generates three DLL files for each compilation:

File TypeFilename PatternPurposeSigned?Reusable?
32-bit Runtime[DLLName]run32.dllRuntime library for 32-bit Office applications✅ Yes (G.D.G. Software)❌ Unique per project
64-bit Runtime[DLLName]run64.dllRuntime library for 64-bit Office applications✅ Yes (G.D.G. Software)❌ Unique per project
Satellite DLL[DLLName].dllContains your compiled VBA bytecode and project-specific dataIntegrity-verified (internal signature)❌ Unique per project

All DLL files are placed in a bin/ subdirectory relative to your protected Office file.

  • 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)
  • DirectoryMyWordDoc/
    • MyWordDoc.docm ← Protected document
    • Directorybin/
      • MyWordDocrun32.dll
      • MyWordDocrun64.dll
      • MyWordDoc.dll
  • DirectoryMyAccessDB/
    • MyAccessDB.accdb ← Protected database
    • Directorybin/
      • MyAccessDBrun32.dll
      • MyAccessDBrun64.dll
      • MyAccessDB.dll

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 If

This means:

  1. The VBA Bridge calls AddDllDirectory to register the bin\ folder in the same directory as the Office file
  2. The Declare statements use the DLL filename only — Windows finds it via the registered search path
  3. The correct runtime (32-bit or 64-bit) is selected at compile time using #If Win64
  4. The runtime then loads your satellite DLL from the same bin\ folder

The two runtime DLLs are digitally signed by G.D.G. Software using an Authenticode certificate.

  1. Windows SmartScreen recognizes the publisher and doesn’t block the files
  2. Antivirus software is less likely to flag the DLLs as suspicious
  3. End users can verify the publisher in Windows file properties:
    • Right-click DLL → PropertiesDigital Signatures tab
    • Publisher: G.D.G. Software
    • Valid timestamp from a trusted certificate authority
PropertyValue
PublisherG.D.G. Software
AlgorithmSHA-256 with RSA
TimestampRFC 3161 compliant (survives certificate expiration)
Certificate AuthorityDigiCert / Sectigo (varies by year)

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.


VBA Padlock provides a dedicated Distribution dialog to prepare your files for distribution.

  1. Click “Distribute” in the ribbon (Project and Build tab)
  2. Select “Create ZIP archive”
  3. Choose a destination for the ZIP file
  4. 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’re creating a custom installer or need to package the files differently:

  1. Click “Distribute” in the ribbon
  2. Select “Copy to folder”
  3. Choose a destination folder
  4. VBA Padlock copies all necessary files while preserving the directory structure

Result:

C:\Distribution\MyExcelApp\
├── MyExcelApp.xlsm
└── bin\
├── MyExcelApprun32.dll
├── MyExcelApprun64.dll
└── MyExcelApp.dll

You 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

Include these instructions with your distribution package:

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)

If you’ve created a proper installer (using Inno Setup, for example), the installation is simpler for users:

  1. Run the installer (e.g., MyExcelApp_Setup.exe)
  2. Follow the installation wizard
  3. Launch the application from the Start Menu or Desktop shortcut
  4. Enter your activation key when prompted

The installer handles the directory structure automatically.


Incorrect:

MyExcelApp.xlsm
MyExcelApp.dll ← WRONG: Missing runtime DLLs

Why 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.


Incorrect:

MyExcelApp.xlsm
MyExcelApprun32.dll ← WRONG: DLLs should be in bin/
MyExcelApprun64.dll
MyExcelApp.dll

Why 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.dll

Why 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.


Incorrect:

bin/
├── MyExcelApprun32.dll
├── MyExcelApprun64.dll
└── MyApp_Protected.dll ← WRONG: Name must match project

Why 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.


For enterprise deployments where the Office file and DLLs are stored on a network share:

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.dll

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: 1

Via Excel UI (for individual users):

  1. File → Options → Trust Center → Trust Center Settings
  2. Trusted Locations → Add new location
  3. Enter: \\server\share\MyExcelApp\
  4. Check “Subfolders of this location are also trusted”