ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing and Applying protection in VBA (https://www.excelbanter.com/excel-programming/280063-re-removing-applying-protection-vba.html)

steve

Removing and Applying protection in VBA
 
Neil,

Change ActiveWorksheet to ActiveSheet

--
sb
"Neil Warwick" wrote in message
...
Is there a way that I can remove and add protection to the
worksheet in VBA on Excel 2000 / XP?
According to the online help I can use the commands:-
ActiveWorksheet.Protect and ActiveWorksheet.Unprotect

I have tried to use them in the format shown below, but
they don't seem to work correctly.

ActiveWorksheet.Unprotect "frodo"
ActiveWorksheet.Protect Password:="frodo"

I'm pretty new to all this VBA stuff so any help would be
appreciated (Can anyone recommend a good book?)

Thanks

Neil




No Name

Removing and Applying protection in VBA
 
Cheers Steve,

How much of a dope do I feel!

Neil


-----Original Message-----
Neil,

Change ActiveWorksheet to ActiveSheet

--
sb
"Neil Warwick"

wrote in message
...
Is there a way that I can remove and add protection to

the
worksheet in VBA on Excel 2000 / XP?
According to the online help I can use the commands:-
ActiveWorksheet.Protect and ActiveWorksheet.Unprotect

I have tried to use them in the format shown below, but
they don't seem to work correctly.

ActiveWorksheet.Unprotect "frodo"
ActiveWorksheet.Protect Password:="frodo"

I'm pretty new to all this VBA stuff so any help would

be
appreciated (Can anyone recommend a good book?)

Thanks

Neil



.


steve

Removing and Applying protection in VBA
 
Neil,

Not a dope! Just crazy Excel Syntax...

Suggest you force Option Explicit at the top of your modules and do a
compile before running your code. You'll catch these a lot faster...
(even though the messages you'll get won't be that enlightening.)

To force Option Explicit (on all NEW macros).
Go to the VBE
Tools Options Editor Require Variable Delcaration

--
sb
wrote in message
...
Cheers Steve,

How much of a dope do I feel!

Neil


-----Original Message-----
Neil,

Change ActiveWorksheet to ActiveSheet

--
sb
"Neil Warwick"

wrote in message
...
Is there a way that I can remove and add protection to

the
worksheet in VBA on Excel 2000 / XP?
According to the online help I can use the commands:-
ActiveWorksheet.Protect and ActiveWorksheet.Unprotect

I have tried to use them in the format shown below, but
they don't seem to work correctly.

ActiveWorksheet.Unprotect "frodo"
ActiveWorksheet.Protect Password:="frodo"

I'm pretty new to all this VBA stuff so any help would

be
appreciated (Can anyone recommend a good book?)

Thanks

Neil



.





All times are GMT +1. The time now is 10:37 AM.

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