how to find out if a file is password protected without opening it?

R

rbd

Is there a way to find out if a file is password protected without
opening it? I want to do this in my vb code.

When I call this line of code below and if the file password protected
(can be encrypted or not ecrypted password), the call fails and just
hangs without giving an error message. So I want to check if the file
is password protected before calling the "SaveAs" method. If it
password protected, I want return a message to the user something like
"This file is password protected" and hence cannot proccess it.

Word.ActiveDocument.SaveAs filename:=sHTMLFileName, FileFormat:=10,
LockComments:=False, Password:="", AddToRecentFiles:=True,
WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False,
SaveFormsData:=False, SaveAsAOCELetter:=False

Also, is there a way to retrieve the password (if the file is password
protected( without asking the user to enter it?

Thanks for your help.
 

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