When you press Alt + F11 to inspect, edit, or debug macros in a workbook, you may find the project explorer tree blocked. Expanding the project produces the dialog: “Project is unviewable.”
This error does not mean your code is corrupted or permanently lost. It almost always occurs because the workbook is configured using Excel’s Legacy Shared Workbook mode, or because the file was compiled and distributed as a protected add-in or binary template.
Quick Answer
The most common reason a VBA project becomes unviewable is the Legacy Shared Workbook feature, which disables the Visual Basic Editor to prevent multi-user code edit conflicts.
To unlock it:
- Open the file in desktop Excel.
- Go to the Review tab and locate the Protect group.
- Click Unshare Workbook (or click Share Workbook (Legacy) and uncheck “Use the old shared workbooks feature instead of the new co-authoring experience”).
- Click OK, save the file, close it, and reopen it. Your VBA modules will now be accessible in the editor.
Why Legacy Sharing Locks the VBA Engine
Microsoft introduced modern co-authoring for files stored on SharePoint and OneDrive, but many business templates still rely on the older “Shared Workbook” feature (introduced in Excel 97).
When a file uses Legacy Sharing:
- Multiple users can modify cell values simultaneously on a network share.
- However, the underlying VBA project is completely frozen. Because Excel cannot merge two developers editing the same Visual Basic module concurrently, the runtime locks the entire
VBAProjectcontainer and flags it as Unviewable.
Workbook Opened
│
├── Check: Is Legacy Sharing Active?
│ ├── YES ──> VBA Editor Locks: "Project is unviewable"
│ │ └── Action: Unshare Workbook > Save > Reopen
│ └── NO
│ ├── Check: Is it an Excel Add-in (.xlam)?
│ │ └── Action: Set IsAddin = False or edit source file
│ └── Check: Is it a compiled third-party template?
│ └── Action: Code was stripped or locked by vendor
Diagnostic and Repair Methods
Follow these methods to regain access to your code depending on how the workbook is configured.
Method 1: Disabling Legacy Workbook Sharing
If the Excel title bar displays [Shared] next to your file name, legacy sharing is active.
- Open the workbook in desktop Excel.
- If your ribbon does not display the old sharing buttons, add them temporarily:
- Go to File > Options > Customize Ribbon.
- In the left drop-down (“Choose commands from”), select All Commands.
- Scroll down and select Share Workbook (Legacy).
- Add it to a custom group on your Review tab and click OK.
- Click Share Workbook (Legacy) on your ribbon.
- In the dialog box, look at the Editing tab.
- Uncheck the box that says:
“Allow changes by more than one user at the same time. This also allows workbook merging.” - Click OK. A confirmation warning will appear: “This action will remove the workbook from shared use and erase the change history.” Click Yes.
- Save the workbook (
Ctrl + S), close Excel completely, and reopen the file. - Press
Alt + F11. The VBA modules, forms, and classes underVBAProjectwill now expand normally.
Method 2: Handling Protected Add-ins (.xlam)
If you are trying to view code inside an Excel Add-in (.xlam) file and see “Project is unviewable,” the add-in was likely flagged as a background helper file without an active visible window.
- Open a blank Excel session.
- Press
Alt + F11to open the VBA Editor. - In the Immediate Window (
Ctrl + G), type the following command (replacingMyAddin.xlamwith your add-in’s exact name) and hit Enter:Workbooks("MyAddin.xlam").IsAddin = False
Workbooks("MyAddin.xlam").IsAddin = False
- Return to Excel’s main interface. The add-in will now display as an ordinary workbook window.
- Return to the VBA Editor and expand the project. If prompted for a password, enter the project password.
- Once you finish reviewing or modifying code, set the property back to an add-in:
Workbooks("MyAddin.xlam").IsAddin = True
Workbooks("MyAddin.xlam").IsAddin = True
- Save the file.
Method 3: Unprotecting Password-Locked Projects
If the project is viewable but prompts for a password that you cannot recall, review VBA Project Locked: Fixing “Project is unviewable” in Shared Workbooks. to understand how enterprise governance locks down proprietary production code.
When Code Cannot Be Unlocked
If none of the above steps work and the workbook was created by an external software vendor, the file may have been processed using an MCR (Macro Code Removal) utility or distributed as an MDE/compiled binary.
In these specialized corporate deployments, the developer explicitly stripped the VBA source code and compiled the macros into raw P-Code before distribution. If the source code was stripped, it cannot be viewed or edited in the Visual Basic Editor; you must contact the original author to obtain the unprotected source template.