View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Test if a file has a password

I haven't tried it on an unopened workbook, you could possibly substitute the
workbook name for ActiveWorkbook and try it. Workbooks("FileName.xls")
format.

If ActiveWorkbook = True Then
MsgBox "File had Password"
Else
MsgBox "Not Password Protected"
End If


"Steven" wrote:

Is there code to test an unopened file to see if it has a password. I just
want it to return True or False or something like that, that the file is
password protected or not. And definitely I do not want to have to open the
file I am testing first.

Thank you,

Steven