Vba project is unviewable

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:UsersUserNameAppDataRoamingMicrosoftWordSTARTUP).

7 Answers 7

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:

Copy template OUT of Start Up Folder, right click file and select "Open" You can debug it.

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.

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.

Open the .dotm from . /STARTUP location and do modifications and saves there.

Open your DOTM file and on Developer Tab (you will need to enable Dev Tab first 1) and choose Document Template and uncheck items that are currently loaded in under Global templates and add-ins.

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 (named Document5 in my case). The macros from the .dot file I opened are active in Document5 , but when I attempt to edit these macros (MS Word Developer tab, Macros button, Edit button) this message pops up:

Читайте также:  Asus pci g31 драйвер

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.

While in Visual Basic Editor (VBE), you click on a VBA project and receive the ‘Project is unviewable‘ error, instead of a password input prompt. You can neither view, nor edit macros.

This article presents the 2 main reasons behind this message. We will also show you how you may be able to gain access to the VBA code inside the locked project.

Project Locked With Unviewable+ VBA

If you have received the file from another person, the most likely scenario is that the workbook or add-in author locked macros to prevent users from viewing or editing his or hers VBA code.

Software tools, such as our popular Unviewable+ VBA application, can protect macros, by making a VBA project unviewable in VBE. In addition, VBA debug mode is disabled, so macros cannot be traced when an error occurs.

​​If the author locked the project using the Unviewable+ VbaDiff level (lowest security), you can use the VbaDiff Windows application to review the code, even if macros are not accessible in Excel.

If the project has been locked with a higher level of protection, it means that the author would like to protect his or hers intellectual property from all 3rd parties. Any attempt to view or extract VBA code from Unviewable+ protected projects may be a violation of your software license agreement. Depending on your jurisdiction, you may be liable for civil compensation or subject to criminal charges.

Читайте также:  Fallout 4 имя главного героя

Workbook Is In Shared Mode

Several Excel features are unavailable in Shared workbooks. Developers cannot write, record, change, view or assign macros, as VBA is unviewable. Users can only run existing macros that don’t access unavailable features. ​

Here is what to do in order to view macros:

    Use our Macro Mover add-in to unlock VBA in a Shared workbook

  • Unshare the workbook from: Review Tab > Unshare Workbook
  • You can protect your macro (VBA code) in your MS Office documents from being view-able in the VBA Editor. Most people are aware of the option to password protect your code but this can be bypassed as shown in this blog. There is also a password-less protection option that simply tells the user that the Project is locked and “unviewable” as shown in the image below.

    The unviewable option is not able to be set through the MS office application itself, but instead, it needs to be done as a modification to the file after it is saved. This feature is documented as the ProjectProtectionState and ProjectVisibilityState attributes of the PROJECT stream in Office files here.

    The ProjectProtectionState and ProjectVisibilityState attributes are encrypted data structures but it turns out that if you set them to something arbitrary, it will protect the document and make it locked/unviewable. If you change only the ProjectVisibilityState it will still show the project structure but not allow viewing of individual code modules. If you change both, you will get the locked/unviewable message immediately upon trying to expand the root of the project and will not be able to see the project structure.

    Читайте также:  Bq strike p max 4g прошивка

    There is a walk through here of how to change your office document to be locked/unviewable, but I would like to provide an automated solution. One major advantage of the automated solution is that it can not only set this protection, it can also remove this protection from any document. I added this feature to Stan Hegt’s (@StanHacked) EvilClippy tool and it can be used as follows.

    To set the Locked/Unviewable attributes use the ‘-u’ option:

    EvilClippy.exe -u macrofile.doc

    To remove the Locked/Unviewable attributes use the ‘-uu’ option:

    EvilClippy.exe -uu macrofile.doc

    You can remove the Locked/Unviewable attributes on files that were not locked with EvilClippy as well.

    Up until this research, the change to make a VBA Project locked/unviewable was sa >ProjectCLS > to all zero’s and use val >ProjectProtectionState (CMG), ProjectVisibilityState (GC) and ProjectPassword (DPB) you can undo this protection.

    Above are values that will undo the protection, but because the MS Office Compound File Binary Format (CFBF) is sensitive to data length changes, your best bet is to let EvilClippy make these changes for you.

    Bonus: The EvilCippy ‘-uu’ option also removes any password protection from the VBA Project.

    Rate this post

    Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *