Problem with ThisDocument code

A

aehan

I have a document that will be available on a website as a Word Document. It
has code in the ThisDocument module that displays a message box giving
administrators the choice of opening it to be edited by them, or opening it
as a protected document containing form fields, that will be available to
users. There is further code in a separate module that updates areas of the
protected document as users fill it in, and then saves the document with a
different name, so it is necessary to keep that code.

The trouble is that although it seemed to work perfectly, when the saved
protected document is re-opened it sees the code in the ThisDocument module
and displays the message box - which I don’t want! How can I tell it not to
see that particular code in the saved document? I need to keep it in the
original document for use by administrators.

Help! Would be really appreciated.

Aehan
 
C

Cindy M.

Hi Aehan,
I have a document that will be available on a website as a Word Document. It
has code in the ThisDocument module that displays a message box giving
administrators the choice of opening it to be edited by them, or opening it
as a protected document containing form fields, that will be available to
users. There is further code in a separate module that updates areas of the
protected document as users fill it in, and then saves the document with a
different name, so it is necessary to keep that code.

The trouble is that although it seemed to work perfectly, when the saved
protected document is re-opened it sees the code in the ThisDocument module
and displays the message box - which I don’t want! How can I tell it not to
see that particular code in the saved document? I need to keep it in the
original document for use by administrators.
One possibility would be to check something in the file being opened and show the
message based on its presence or value. The document name seems to be one
possibility. So, roughly:
If Me.Name = "Name of your document" Then
'Show the message
End If

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
A

aehan

Hi Cindy

Thank you very much for your reply.

I had worked it out to a smiliar piece of code, but probably not as
effective as yours. I had written:

If ThisDocument.name = "test.doc" Then

I've changed ThisDocument.name to me.name Thank you for your help and for
taking the time to reply. It's really appreciated.

Best wishes
Aehan
 

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