Protect/Unprotect Sheets

D

Deeds

I am trying to write code to 1st unprotect a sheet, then refresh all links, then re-protect the sheet. Everytime it seems to say I can't refresh because the sheet is protected. How can I have it do the above in that order so it unprotects, refreshes, and then protects again?
Thanks
 
S

steveB

This will protect the Active sheet with a password:
ActiveSheet.Protect "mypassword"

This will unprotect the Active sheet with a password:
ActiveSheet.UnProtect "mypassword"

Remove "mypassword" and it will protect/unprotect without a password.

hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me direct)


Deeds said:
I am trying to write code to 1st unprotect a sheet, then refresh all
links, then re-protect the sheet. Everytime it seems to say I can't refresh
because the sheet is protected. How can I have it do the above in that
order so it unprotects, refreshes, and then protects again?
 
Top