Saving Protected Documents

J

JB

I've got a Word form that opens with a user form. When this is closed it
protects the document using

ActiveDocument.Protect Password:="1234", NoReset:=False, Type:= _
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False

And then opens a 'save as' dialog box to allow the user to choose the
location and filename. The document is then protected so that no more
changes can be made.

However, if i change the macro so that it saves automatically using '
ActiveDocument.SaveAs' to a llocation and with a name of my choice then it
doesn't keep the protection. Any ideas how i can get this to work?

Jon
 
G

Graham Mayor

How about

sFname = "Filename.doc"
ActiveDocument.SaveAs FileName:=sFname, WritePassword:="1234"

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JB

Hi Graham,

I had a play with this but it doesn't work in the same way. The
'ActiveDocument.Protect' works straight away and stops people changing the
text ( i.e. they could only add things through the user form).

Using 'WritePassword:="1234"' doesn't start working until it is closed and
reopened and also brings up lots of dialog boxes. The former method seems
much neater for what i want to do, i just can't see why it wont work when i
use the 'ActiveDocument.SaveAs' way of storing?

Jon
 

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