Determine if document is password-protected?

B

BMC

I have a VBA script which loops through all the Word documents in a directory
and its subdirectories, opens each then makes a change (path to attached
template), saves and closes.

All good so far, but where a document is password protected, the password
prompt appears, which is no good as this is to be an automated, unattended
process on thousands of documents.

So I need to be able to detect if a document is password protected so that
it can be noted and skipped.
 
J

Jonathan West

BMC said:
I have a VBA script which loops through all the Word documents in a
directory
and its subdirectories, opens each then makes a change (path to attached
template), saves and closes.

All good so far, but where a document is password protected, the password
prompt appears, which is no good as this is to be an automated, unattended
process on thousands of documents.

So I need to be able to detect if a document is password protected so that
it can be noted and skipped.

Skipping Password-Protected Documents in a Batch Process
http://www.word.mvps.org/FAQs/MacrosVBA/CheckIfPWProtectB4Open.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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