Password Recovery

Remove a VBA Project Password with a Hex Editor

Leena Taylor Paul By Updated August 28, 2026 10 min read
Quick Answer

A VBA project password never encrypts your macros. It stores a scrambled hash in a small text block called the PROJECT stream, and a hex editor can overwrite that block so the editor stops asking for a word. The route is free, and it breaks the file enough of the time that it is worth knowing why first. A dedicated remover does the same swap without the risk.

Search for a way past a locked VBA project and every forum gives you the same answer. Rename the file to a zip, find vbaProject.bin, edit it in a hex editor. It works on many files and quietly ruins others. This page is the reference the rest of our Office guides point back to, so it covers what the edit really changes, why it fails and when to stop.

What a VBA Project Password Really Is

The password protects far less than you might think. Setting it does not encrypt a single line of your code. The macros stay in the file in compressed but fully readable form, and the password only tells the Visual Basic Editor to ask for a word before it shows them. Security researcher Didier Stevens explained this on the SANS Internet Storm Center, noting that a protected project can be read straight from disk because the code was never hidden. What the file does store is a hash of the password, the SHA1 of the word plus a short salt, then scrambled and written into the project. Microsoft describes the exact layout in its MS-OVBA specification. Because there is a hash and the code was never encrypted, the lock can be lifted without ever knowing the word.

VBAProject Password
Password
•••••••••
OK
Cancel
The prompt a locked project shows when you try to expand it in the Visual Basic Editor

The PROJECT Stream and Its Keys

Inside vbaProject.bin sits a short text block named the PROJECT stream. It reads like a small settings file, and four of its lines carry the protection. Replace them correctly and the lock is gone.

PROJECT stream
ID="{7B2E9A14-3C5D-4F80-9A6B-1E2F3A4B5C6D}" (the scramble key)
Document=ThisWorkbook/&H00000000
Name="VBAProject"
CMG="7A2C4E6180A290B2C0D4E6F8" (lock state)
DPB="9F3B71C2E84D05A6B7C8D9E0F1223344556677889900AABB" (password hash)
GC="4D5E6F70818293A4" (visibility)
The four protection lines as they sit in the PROJECT stream, with DPB the longest because it carries the hash
KeyWhat it holds
IDThe project GUID. The scramble key for the other three lines comes from it.
CMGThe lock state, showing whether the project is set to protected.
DPBThe scrambled password hash. Longer than the rest, because it carries the hash.
GCThe visibility state for the project.

The Hex Editor Method, Step by Step

The reliable version of the trick does not change only one value. It copies the four protection lines from a project that has no password and puts them into the locked one, so every entry still matches the rest.

  1. Copy the locked fileAlways work on a duplicate, never the only copy you hold.
  2. Open it as a zipRename the extension to .zip and browse into vbaProject.bin in the right folder.
  3. Find the PROJECT streamOpen the binary and locate the ID, CMG, DPB and GC lines.
  4. Swap in unprotected valuesReplace all four with the matching lines from an unlocked project, then zip it back up under its real extension.

On the next open the editor acts as if the project has no password and lets you into the code. Clearing only one value works some of the time, but the matched swap is what keeps the file in one piece.

budget-macros.zip  ›  xl
Name Type
_relsFile folder
drawingsFile folder
vbaProject.binBIN File
workbook.xmlXML File
Inside the renamed zip, vbaProject.bin sits in the xl folder for an Excel workbook
vbaProject.bin
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Decoded text
000000C0 4E 61 6D 65 3D 22 56 42 41 50 72 6F 6A 65 63 74 | Name="VBAProject
000000D0 22 0D 0A 43 4D 47 3D 22 37 41 32 43 34 45 36 31 | "..CMG="7A2C4E61
000000E0 38 30 41 32 39 30 42 32 43 30 44 34 45 36 46 38 | 80A290B2C0D4E6F8
000000F0 22 0D 0A 44 50 42 3D 22 39 46 33 42 37 31 43 32 | "..DPB="9F3B71C2
00000100 45 38 34 44 30 35 41 36 42 37 43 38 44 39 45 30 | E84D05A6B7C8D9E0
00000110 46 31 22 0D 0A 47 43 3D 22 34 44 35 45 36 46 37 | F1"..GC="4D5E6F7
00000120 30 38 31 38 32 39 33 41 34 22 0D 0A | 0818293A4"..
The same CMG, DPB and GC values inside vbaProject.bin, with the DPB bytes selected in a hex editor
Skip the byte editing and clear the lock cleanly

The Univik VBA Password Remover makes the same matched swap of the ID, CMG, DPB and GC values in one step, with an automatic backup and no hex editor needed. It runs across Excel, Word, PowerPoint, Access and Outlook.

Free Download See All Features

Which Folder Holds vbaProject.bin

Once a macro file is renamed to a zip, the project binary sits in an application folder that changes with the program. Open the wrong one and you will not find the file.

ProgramFolder inside the zip
Excelxl
Wordword
PowerPointppt

People treat the hex edit as a single quick change, but those four lines only make sense as a set. Change one and leave the others, and Office will not open the project at all. Half the corrupted files we see started as a one character fix that looked harmless.

NR
Nick Rogers
Founder, Univik
Building Windows tools since 2013

Why the Keys Depend on the Project ID

Here is the part the quick tutorials skip. The CMG, DPB and GC values are not scrambled on their own. Their scramble key is built from the project ID, the GUID on the first protected line. That is why the four lines have to stay together. Copy the ID, CMG, DPB and GC from one unprotected project as a matched set and Office reads them cleanly. Change the ID alone, or paste a DPB that belongs to a different ID, and Office cannot read them. Microsoft's format notes and independent write ups both point to the same result, that a single wrong character in the ID leaves the project unable to read its own settings. The lock is weak, but it is picky. It expects its parts to match.

Where the Hex Method Fails

The trick was written for older files, and Office has changed since. A few things turn a five minute job into a dead file. Newer builds and the 64 bit version changed how the protection lines are stored, so instructions written years ago no longer fit. The replacement values have to match the file's expected lengths, and a size mismatch leaves Office unable to read the project. A single mistyped byte in the editor does the same. When any of these happens the result is the same message, a project shown as unviewable, sometimes removed completely on the next save. On a file that matters, that is a high price for a free method.

Microsoft Visual Basic for Applications
Project is unviewable.
OK
What you see instead of a password prompt when the four lines fall out of step

Access and Outlook Break the Pattern

The whole method depends on the file being a zip, and two Office programs do not work this way. An Access database in .accdb or .mdb is a binary database, not a zip, so there is no folder to browse and no vbaProject.bin to reach. Outlook keeps its one project in a file called VbaProject.OTM, which is itself a binary container and not a zip. For both, renaming to .zip opens nothing. The manual path there means editing the binary directly, which is even riskier, so the Access guide and the Outlook guide handle each in its own way.

When to Skip the Hex Editor

The manual route makes sense when the file does not matter and you want to see how it works inside. It stops making sense the moment the file matters. One wrong value on your only copy of a finance model or a shared template is not a saving, it is a loss. A remover does the same matched swap of the ID, CMG, DPB and GC lines, keeps a backup of the original and never asks you to touch a byte. If the project is worth unlocking, it is worth not risking it. The guides below show the tool for each app.

Per App Quick Routes

Each Office program stores and locks its macros a little differently. These guides take the method on this page and apply it to your file: Excel for spreadsheets and the three locks people confuse, Word for documents and templates, PowerPoint for decks and add-ins, Access for its two separate passwords and Outlook for the single OTM project. The remover range covers all of them.

Hex Editor and VBA Password Questions

No, because the code was never encrypted. Only the password part in the PROJECT stream is scrambled. The macros themselves sit in compressed but readable form, so the edit changes the lock entry and leaves the code alone.

They are entries in the PROJECT stream. DPB holds the scrambled password hash, CMG records the lock state and GC records visibility. All three are scrambled with a key made from the project ID, so they only make sense together.

The CMG, DPB and GC values are keyed to the project ID. Change one byte so it no longer matches the others and Office can no longer read them, so it reports the project as unviewable and may remove it. Matched replacement values avoid this.

No. Those are not zip archives, so there is no folder to open and no vbaProject.bin to reach. Access and Outlook need a different route, which the guides for each cover in full.

On a file you own or have the right to fix, yes. The project password guards code, not data, and clearing it on your own work is a normal thing to do. Removing it from a file you have no right to touch is a different thing.

Yes. A remover performs the same matched replacement of the ID, CMG, DPB and GC values in one step, without a hex editor and without the risk of breaking the file. It is the safer choice on a file you cannot afford to lose.
Leena Taylor Paul

Written and maintained by Leena Taylor Paul and the Univik team, developers of Windows data conversion and recovery software since 2013. Most of the corrupted projects that reach our support queue began as a hand edit that changed one of the four lines and not the rest, so this reference explains why they move together. Last verified August 2026. Left with a project marked unviewable after an edit? Contact our support team.