View Full Version : Unprotecting Read only Word Documents
I have multiple files in multiple sub folders. Some of them have a read only password of "xyz" and some of them have no password.
How can I write a VBA code to traverse all these files and:
- if password exists, remove it, save it, then move on to next file
- if it does not exist, move on to the next file
THANKS !!!
fumei
06-01-2007, 01:37 PM
By read-only password, do you actually mean file open with password?
Hey fumei,
I'm referring to the "password to modify" option in Tool -> options -> security.
Whenever I try to open a document which has such a password, a window pops us:
*.doc is reserved by Author.
Enter password to modify, or read open only.
By read-only password, do you actually mean file open with password?
fumei
06-01-2007, 08:51 PM
And it always will. Unlike the password for Forms, TrackChanges, you can not pass the password string as a parameter to the Open method. It does not accept it as a valid argument.
Perversely:
if it does not exist, move on to the next filethis CAN be done.
A file with a Open/Modify password has HasPassword = True. This can be tested. So if it is False, there is no password. But...shrug...that is ALL you can do. You can test if it has a password, but even if you know that password, you still can not give it as an argument.
Open/Modify password protected document must have the password entered manually.
Which, from a security point of view makes perfect sense. Otherwise, it would not be too difficult to write code that uses thousands of iterations of strings to find the password. That sort of stuff is done all the time.
I hope you do not find a way to do this. However...since I am always interested in interesting things with Word, hey...if you do, let us know!
fumei
06-01-2007, 08:54 PM
Actually, you can't even to that. HasPassword needs the document open...
Well, that's interesting fumei..and a little disappointing coz it makes my work harder right now :)
But yea, I did download a software which cracks these passwords..surprisingly it worked on some of the files and removed the password...but not on others....
fumei
06-04-2007, 08:56 AM
That is not surprising at all.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.