Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
WimR
 
Posts: n/a
Default ActiveWorkbook.Protect password:=range("rangename") does not work

I am trying to have macro protecting a workbook, with a password
specified by an administrator in one of the hidden worksheets.
The cell in the hidden worksheet in which the password is specified is
named, so I want to use the range name in the macro that
protects/unprotects the workbook.


It all works well when I try to unprotect the workbook, using the code
: ActiveWorkbook.Unprotect password:=range("rangename").
However, I get an error when I try to protect the workbook with the
code: ActiveWorkbook.Protect password:=range("rangename")
The error message is: Runtime Error "1004, Application-defined or
Object-defined error.


Can anybody help ?


Many Thanks
Wim Ruepert
Sydney, Australia

  #2   Report Post  
abcd
 
Posts: n/a
Default

the cell is not a password, but its content (the value) may be one:

try:

range("rangename").value
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"