Project Locked - Project is Unviewable

  • Thread starter MT DOJ Help Desk
  • Start date
M

MT DOJ Help Desk

Word 2000
NT4

I just completed a set of macros that are stored in the This Document
module. I wanted to add a minor feature today, but when I tried to open the
module, I got an error message saying:

Project Locked:
Project is Unviewable

I did not lock the project. Fortunately, I have a backup of my code.
However, this is the second time this has happened with this same set of
macros, and while that may just be a coincidence, I'm wondering if there
could be anything that I've done in the project that might cause this
problem. There are no forms in the project, but there is a reference to the
Microsoft Forms 2.0 Object Library. Interestingly, I added the reference to
the Microsoft Forms 2.0 Object Library just yesterday, and now this problem
crops up. Aside from This Document, there are no code modules in the
project. The macros themselves are pretty straight forward macros for
selecting, copying, pasting, deleting, and printing blocks of text. There
is an auto open macro that shows a custom toolbar, which is available only
in this particular document, and a close macro that hides the toolbar before
saving and closing the document. The Paste macro saves the document after
each paste, and there is a data object for getting data from, and writing
data to, the clipboard.

Is there anything in all of that which may be causing this problem?

Thanks for any help you can offer.

--Tom
 
P

pre

Maybee this will help:
Use this property to gain access to code modules and user forms.

To view the VBProject object in the object browser, you must select the
Microsoft Visual Basic for Applications Extensibility check box in the
References dialog box (Tools menu) in the Visual Basic Editor.
 
J

Jezebel

It might be a function of where you are storing the macros. If they are
going into a module under 'This Document' they are getting attached to the
document open at the time, and saved as part of that document. Depending on
how you work with the macros, you might then be creating a reference from
normal.dot to the file containing the macros. Word sorts all that out when
you simply run the macro; but if you try to view your code you get the
message 'Project is unviewable' if the original document is not open.

A better place to store code is a template saved in the start-up folder,
functioning as an add-in.
 
M

MT DOJ Help Desk

Either you're not understanding my post, or I'm not understanding your
reply, so let me try to clarify. The macros are stored in the ThisDocument
object (In the VB Editor go to Project > Microsoft Word Objects >
ThisDocument). If the document is not open, then the project will not be
visible in the VB Editor. Therefore, logic would suggest that if I can see
the project listed in the VB Editor, the document must be open. Your reply
seems to suggest that the project of a document that is NOT open can be
visible in the VB Editor, and as far as I know, that's impossible. Unless I
am missing something, the very fact that I can see the project in the VB
Editor, and that I can use the macros (which are available only in the
original document), must mean that original document is open (and it is
because I open it manually).

The reason I put the code in the ThisDocument object is that I wanted to
make sure the macros stay with the document, and that they are available
only when a particular document is open.
 
M

MT DOJ Help Desk

That did the trick! Thanks for the help. I've had this problem with other
projects in the past, and I never had a solution other than creating a new
project from backup data. I will definitely remember this trick!

--Tom
 
J

Jezebel

If you have a project in an add-in, its name shows up in the list of
projects. It is 'visible' to VBA in the sense that you can use the macros
and run the code within it; but you can't view the project unless the add-in
is also open as a document. Double-clicking the project name, with the
add-in document not open, gives the 'Project is Unviewable' error.
 
R

rami

Jezebel said:
If you have a project in an add-in, its name shows up in the list of
projects. It is 'visible' to VBA in the sense that you can use the macros
and run the code within it; but you can't view the project unless the add-in
is also open as a document. Double-clicking the project name, with the
add-in document not open, gives the 'Project is Unviewable' error.


this happened to me also.
after ending the process for "winword.exe",
and opening a word document,
the project became viewable.

very weired.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top