When I try to edit or step into my VBA code for debugging purpose I get "Project is Unviewable". I have created .dotm file at location (C:\Users\UserName\AppData\Roaming\Microsoft\Word\STARTUP).
-
I didn't Get any answer from that link..Anybody having idea about this issue? – user3463768 May 23 '14 at 12:04
-
@Gareth, as of 1/9/17, StackOverflow lists [How to debug Word VBA Macro](http://stackoverflow.com/questions/23802593/how-to-debug-word-vba-macro) as removed. – CODE-REaD Jan 09 '17 at 15:08
-
1Possible duplicate of [Word VBA "Project is unviewable"](http://stackoverflow.com/questions/6017813/word-vba-project-is-unviewable) – Máté Juhász Mar 10 '17 at 14:22
10 Answers
When launched automatically at startup the VBA project in .DOTM files are not viewable. I couldn't find this clearly documented by Microsoft but I tested/replicated it across multiple OS and versions of Office to conclude it was "by design"
There is some ways around it:
Option #1
Copy template OUT of Start Up Folder, right click file and select "Open" You can debug it.
Option #2
Ensure you have write permission to file in startup folder. Even if you are Admin, if UAC is ON you won't have access - grant your user "full control" or "write access to file" to DOTM file in startup folder.
Close all instances of Word, right click .DOTM file and Open, you can now debug it.
However you can't save changes - to save changes you must grant permissions for the user to write to the STARTUP folder.

- 2,468
- 1
- 22
- 43
Update 2022
When editing macro-enabled Word documents (for example, .docm
files) that are stored on OneDrive, you may receive the following warning:
SECURITY WARNING
Macros have been disabled.
Enabled Content
After clicking Enabled Content, and opening the VBA editor, attempting to view the project may result in the error:
Project is unviewable
After closing and reopening the document, again open the VBA editor. Within the Word document, you will then receive the following message:
EDITING MACROS
Check out this document to view and edit its macros.
Check Out
After checking out out the document, macros may be edited.

- 21,862
- 3
- 86
- 117
-
I had to re-open the file several times until the "Check Out" option appeared. – Benjamin Ziepert Jan 12 '22 at 13:48
this is not a bug. This is a feature of Microsoft Templates when you open a template it never opens original file rather opens a copy of the template. to modify or debug a template right click on template itself and say open or open word and use Open file dialog to modify the code of the template.

- 69
- 1
- 1
- 7
-
Apologies for reviving an old thread, but is there any way to view the VBA project *from a document based on the add-in*, without having to open the add-in itself? I have a .dot template that I have made a Global add-in by storing it in the Startup folder. This template has a DocumentOnClose handler that I need to debug. Modifying the template and closing Word doesn't fire this event (at least not for me) so I need to debug the code *in the document*, not the template. Thoughts anyone?? I can *almost* get it to work if the template is open in Word at the same time, but this is very tedious... – Kenny83 Aug 09 '17 at 13:33
-
One trick i can suggest. you can open a new document and insert new module then add one procedure and create a document object now that object you need to set to open your addin file so pass the path of the file and hit F8 key to start debugging you will be able to see the code of the adding written in automatically. – Rashid Khan Apr 26 '19 at 14:20
To expand on https://stackoverflow.com/a/39171282/5025060, in my case (Windows 7 Pro, MS Word 2007), left-clicking on a .dot file from Windows File Explorer (Win+E) causes MS Word to create a new document (namedDocument5
in my case). The macros from the .dot file I opened are active inDocument5
, but when I attempt to edit these macros (MS Word Developer tab, Macros button, Edit button) this message pops up:
However, if I right-click on the .dot file from Windows File Explorer, select Open With, and choose Microsoft Office Word from File Explorer's menu, MS Word opens the file for editing rather than creating a new Document (the name in Word's Title Bar is that of the .dot file I opened). From this instance of Word I can view and edit the macros contained in the .dot file.
For anyone having this issue that uses Office 365 with OneDrive, please note that if your docm document was previously synced to your OneDrive, but your OneDrive is currently logged out, this will cause the "Project is unviewable" error. If you log back into OneDrive and sync the docm file, you should be able to edit the VBA as normal. In my case, this fixed the issue.

- 1
In my case, with Office 365 Word, it's probably one or two Word bugs, but I could find a workaround and maybe it will help some people.
I copied a xxxx.docm
file from my personal Onedrive (where macros could be edited) to a local folder on my laptop.
I opened the local xxxx.docm
file and couldn't edit the macros:
I then created a test.docm
document in the same local folder, closed both documents.
I then opened test.docm
and xxxx.docm
(the reverse sequence doesn't work), and surprisingly the project is no more locked in the VBA editor (!?):
After saving xxxx.docm
, the project lock is definitely removed.
PS: my laptop is managed by my company, I don't know if some security software are implied in the problem.

- 11,934
- 5
- 22
- 48
For editing VBA you have to go to Review/Share workbook. Need to disable checkbox.
Good luck =)

- 181
- 6