VBA to save Word as Read-Only

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

dgetz

Thread Starter
Joined
Aug 14, 2001
Messages
5
Anyone know how to save the active document as read-only using VB? ActiveDocument.ReadOnly = True doesn't work because the document is already open.

Thanks,
Dan

Actually, I figured out a way to do it:
ActiveDocument.WritePassword = "your_password_here"

This will then cause the document to open up with three options: open (to be able to edit), read-only, and cancel. To be able to open the file, you have to enter the password.

Of course, make sure to protect your code otherwise, anyone could just look at the code and see the password to edit the document.
 
Joined
Dec 20, 2001
Messages
17
I recorded a macro and checked the "Read Only Recommended"
Then looked @ the code.
I saw:

ActiveDocument.ReadOnlyRecommended = True
 

dgetz

Thread Starter
Joined
Aug 14, 2001
Messages
5
Actually, this only recommends that the user opens as read only (I believe). It does not force them to open it as read only. The above code will force them to enter the password if they want to edit it.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top