How can I password protect all word files in a folder?

Anonymous
2012-05-01T22:45:14+00:00

How can I password protect all word files in a folder? I know there is a macro for it I just cant write it. I can't get my head rounf visual basic I am only an admin who has to lock hundreds of files a month with the same password. Please someone give me a magic macro code and how to insert it.

I have been studying forums but I am no cleverer than 3 days ago. Tutorials don't help either.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Jay Freedman 208.1K Reputation points Volunteer Moderator
2012-05-02T14:44:24+00:00

> What am I doing wrong?

You missed this in my post:

>> change the path (be sure to keep the backslash at the end)

So you need to change this line:

     strFilePath = "C:\LOCKIT"

to this:

     strFilePath = "C:\LOCKIT"

The reason nothing was happening is that the Dir$() command takes that string and adds "*.doc*" to the end of it; without the backslash you're getting "C:\LOCKIT*.doc*" as the file to look for, and there is no such file (which would have to be in the root folder, C:).

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

7 additional answers

Sort by: Newest
  1. Anonymous
    2014-12-01T23:12:22+00:00

    Wow. That worked perfectly. Thank you. You've just saved me countless hours of work.

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2014-11-28T17:22:01+00:00

    Hi there. I'm wondering if you can tell me how to modify this macro in two ways. First, I'd like to password-protect all of the files in a folder so that the only thing the password does is turn on the Track Changes (see snip below; I don't want recipients to be able to turn off the track changes). And, second, I'd also like to (separately) modify the macro to unprotect all of those same files in a folder. I'm using Microsoft 2010 on Windows 7.Tthanks.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-05-04T07:12:07+00:00

    Jay!! 

    Thank you!

    You did tell me , yes. I skipped over that detail again and again!

    The macro worked a treat!

    Looking into virtual basics now. Pretty exciting!

    Thanks again for taking the time to look!

    Was this answer helpful?

    0 comments No comments