Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi everyone I am using these two lines of code to determine whether or not workbook protection or worksheet protection has been turned on. If ActiveWorkbook.ProtectStructure = True Then ... If ActiveSheet.ProtectContents = True Then ... this works fine,but I would like to know of it is possible to detect if either of these methods of protection, if being used, are password protected. I am a bit stumped here. Thanks for any advice. DJB -- DJB ------------------------------------------------------------------------ DJB's Profile: http://www.excelforum.com/member.php...o&userid=21221 View this thread: http://www.excelforum.com/showthread...hreadid=375003 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
DJB,
You could try to unprotect the object without supplying a password. If it fails, then a password is required. NickHK "DJB" wrote in message ... Hi everyone I am using these two lines of code to determine whether or not workbook protection or worksheet protection has been turned on. If ActiveWorkbook.ProtectStructure = True Then ... If ActiveSheet.ProtectContents = True Then ... this works fine,but I would like to know of it is possible to detect if either of these methods of protection, if being used, are password protected. I am a bit stumped here. Thanks for any advice. DJB -- DJB ------------------------------------------------------------------------ DJB's Profile: http://www.excelforum.com/member.php...o&userid=21221 View this thread: http://www.excelforum.com/showthread...hreadid=375003 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Nick and thanks for your suggestion. However, if you try to unprotect a password protected worksheet or workbook using a macro, it doesn't fail, it just asks you for the password. Any other ideas? Anyone...? Thanks DJB -- DJB ------------------------------------------------------------------------ DJB's Profile: http://www.excelforum.com/member.php...o&userid=21221 View this thread: http://www.excelforum.com/showthread...hreadid=375003 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
Application.DisplayAlerts = False On Error GoTo line1: ActiveSheet.Unprotect password:="" Application.DisplayAlerts = True Exit Sub line1: MsgBox "Password reguired" Application.DisplayAlerts = True -- rand451 "DJB" wrote in message ... Hi Nick and thanks for your suggestion. However, if you try to unprotect a password protected worksheet or workbook using a macro, it doesn't fail, it just asks you for the password. Any other ideas? Anyone...? Thanks DJB -- DJB ------------------------------------------------------------------------ DJB's Profile: http://www.excelforum.com/member.php...o&userid=21221 View this thread: http://www.excelforum.com/showthread...hreadid=375003 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks very much for your help guys. I was hoping that there would be a read only flag I could check or something like that - I really only wanted to return the information, not turn the protection off - but it seems it doesn't work that way! Anyway, thanks for the example code - it's got me sorted on the right track. Thanks again! DJB -- DJB ------------------------------------------------------------------------ DJB's Profile: http://www.excelforum.com/member.php...o&userid=21221 View this thread: http://www.excelforum.com/showthread...hreadid=375003 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to retrive password protected worksheet but forgot password? | Excel Worksheet Functions | |||
password to open Excel file option does not exist | Excel Worksheet Functions | |||
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. | Excel Worksheet Functions | |||
bypass password when update linking of password protected file | Excel Discussion (Misc queries) | |||
Excel password but cant hide the sheets before entering password | Excel Programming |