Unprotected Word Document is Changed?

R

RPJ

When I unprotect a Word (2003) form document and then reprotect it (without
having made any changes at all) - closing the document causes the "Do you
want to save the changes to ......" message to appear.

Is it possible to unprotect / protect a Word document without it being
mysteriously changed by Word (n.b. there are no changes to "Undo")?

I am trying to write a VBA Macro to unprotect the document, interrogate the
status of cell within a table and then, optionally, reprotect the document
without changing it: Can this be done?

All offers of help will be very gratefully received.

RPJ
 
P

Peter T. Daniels

Turning protection on or off is itself a change. There's been no
change in the content of the document.
 
G

Graham Mayor

Yes and no. Opening the document and unprotecting it is seen as a change so
you cannot do that without Word seeing that as a change. However you can
close the document again without saving it after interrogating it e.g.

ActiveDocument.Close WdDoNotSaveChanges

You don't need to unprotect the document to read the content of a form
field.

Take a look at the examples at
http://www.gmayor.com/ExtractDataFromForms.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

RPJ

Gentlemen,

Thank you both very much for your incredibly swift responses.

I think the answer to my question is "NO" because:
a) it is not possible to "undo" the changes in status of the document
(from protected to unprotected and back again)
b) I do not wish to close the document in my Macro - but neither do I
want the user to receive the "save changes?" message if they should
chose to manually close the document at this point.

HoHum

Thanks again,

RPJ
 
G

Graham Mayor

If you don't want to close the document then mark it as saved after you have
finished processing it with your macro eg

ActiveDocument.Saved = True

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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