Skip to content

VBA Compilation

VBA Padlock’s core feature is its ability to compile VBA source code into native, protected DLLs.

Instead of leaving your intellectual property exposed in the insecure VBA editor, your logic is transformed into encrypted bytecode and moved into external library files. The Office document itself only contains a lightweight VBA Bridge module that acts as a secure connector.

VBA Compilation Overview


The compilation process is designed to be seamless while providing maximum security.

Write your sensitive VBA logic directly within the VBA Padlock Studio editor. You can use standard VBA syntax and access the full Office Object Model.

VBA Padlock Studio Code Editor

Developer Tip: Because your scripts are stored as plain text files, you can use AI Coding Agents (like Claude Code, Gemini, OpenAI Codex or Cursor) to help you refactor code, fix compatibility issues, or even write entirely new protected modules.


When you compile, VBA Padlock creates a bin/ directory containing the files necessary for your application to run.

Distribution Package

  • MyWorkbook.xlsm ← Protected Office file (VBA Project is locked)
  • Directorybin/ ← Distribution folder (required)
    • MyWorkbookrun32.dll ← 32-bit Secure Runtime
    • MyWorkbookrun64.dll ← 64-bit Secure Runtime
    • MyWorkbook.dll ← Your compiled logic (Satellite DLL)
ComponentResponsibilityProtection
Runtime DLLsInterface between Office and your code.Authenticode Signed by G.D.G. Software.
Satellite DLLStores your encrypted VBA bytecode.Cryptographic Integrity Verification.
Office FileUI and public entry points.VBA Project Password Protected.

Compiled scripts are not “disconnected” from your workbook. They have full, high-speed access to the host application.

  • Full Object Model: Use Application.ActiveWorkbook / ActiveSheet (Excel), Application.ActiveDocument (Word), Application.ActivePresentation (PowerPoint), or Application.CurrentDb (Access).
  • COM Support: Use CreateObject for FileSystemObject, ADODB, or custom libraries.
  • Built-in API: Access over 60+ specialized functions for licensing and security.

Calling a protected function is simple. Use the VBAPL_Execute function provided by the VBA Bridge.

' --- OFFICE VBA SIDE (Module1.bas) ---
Public Sub OnClick_Calculate()
Dim result As Variant
' Call "CalculateTax" inside the compiled DLL
result = VBAPL_Execute("CalculateTax", Range("A1").Value)
MsgBox "Tax Result: " & result
End Sub
' --- COMPILED SIDE (VBA Padlock Studio) ---
Public Function CalculateTax(Amount)
' This code is invisible to the user and survives reverse-engineering
CalculateTax = Amount * 0.20
End Function

A common misconception is that compiled code is “isolated” from your document. On the contrary, your protected scripts have full, native access to the host application.

Host ApplicationGateway ObjectTypical Usage
Microsoft ExcelApplication.ActiveWorkbookRead/Write cells, format ranges, protect sheets.
Microsoft WordApplication.ActiveDocumentGenerate reports, replace bookmarks, manage sections.
Microsoft AccessApplication.CurrentDbExecute SQL queries, open recordsets, manage data.
Microsoft PowerPointApplication.ActivePresentationCreate slides, automate animations, export to PDF.

Pro Tip: Moving your heavy data processing into the compiled DLL is not only more secure, it is often faster because it bypasses the overhead of the standard VBA interpreter for complex logic.


  • Native Performance: Bytecode is executed by a custom-built virtual machine optimized for VBA logic.
  • Anti-Tamper: The Satellite DLL is bound to the Runtime DLLs. Modify one, and the application will refuse to load.
  • AV Friendly: Our runtime DLLs are digitally signed, ensuring high trust with antivirus software and Windows SmartScreen.