ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detect Password Protection (https://www.excelbanter.com/excel-programming/308186-detect-password-protection.html)

Keith Ralston

Detect Password Protection
 
Is there any way to detect when an XLS is password protected?

Otto Moehrbach[_6_]

Detect Password Protection
 
Keith
Something like this perhaps:
Sub testme02()
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
If .ProtectContents _
Or .ProtectDrawingObjects _
Or .ProtectScenarios Then
MsgBox "oh, oh. Somekind of protection"
End If
End With
End Sub

HTH Otto

"Keith Ralston" wrote in message
m...
Is there any way to detect when an XLS is password protected?




Keith Ralston

Detect Password Protection
 
Can this be done before I attempt to open the spreadsheet?

I need to process a large number of XLS files. I want to note pwd
protected files as exceptions. I am using Automation, not VBA as you
have indicated below.

Otto Moehrbach wrote:
Keith
Something like this perhaps:
Sub testme02()
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
If .ProtectContents _
Or .ProtectDrawingObjects _
Or .ProtectScenarios Then
MsgBox "oh, oh. Somekind of protection"
End If
End With
End Sub

HTH Otto

"Keith Ralston" wrote in message
m...

Is there any way to detect when an XLS is password protected?





Dave Peterson[_3_]

Detect Password Protection
 
Otto's code checks for worksheet protection. It kind of sounds like you want to
check for the file|open type of protection.

I'm not sure how you're automating this (VB??), but if I were doing it in
excel's VBA, I could do try to open it with a password of "" and if it failed,
it had a real password:

Here's a link that uses Excel to make a report for each workbook in a folder:
http://groups.google.com/groups?thre...E05F%40msn.com

Keith Ralston wrote:

Can this be done before I attempt to open the spreadsheet?

I need to process a large number of XLS files. I want to note pwd
protected files as exceptions. I am using Automation, not VBA as you
have indicated below.

Otto Moehrbach wrote:
Keith
Something like this perhaps:
Sub testme02()
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
If .ProtectContents _
Or .ProtectDrawingObjects _
Or .ProtectScenarios Then
MsgBox "oh, oh. Somekind of protection"
End If
End With
End Sub

HTH Otto

"Keith Ralston" wrote in message
m...

Is there any way to detect when an XLS is password protected?





--

Dave Peterson


timatey

Detect Password Protection
 
There is free utility to searche for password protected documents
(Word, Excel) on your computer http://lastbit.com/findpswdoc.asp

Keith Ralston wrote in message om...
Is there any way to detect when an XLS is password protected?



All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com