macro for protection

G

Guest

I recorded a macro to protect a sheet and then then workbook - and I input a
password. The recorded macro protects both the sheet and workbook - but
doesnt use a password. Is there a syntax to use to protect them with a
password ?
This is my code for recording the macro.

Application.CutCopyMode = False
ActiveWorkbook.Protect Structure:=True, Windows:=False

Thanks,
Yosef
 
T

Trevor Shuttleworth

Yosef

lookup Protect in the VBA Help

ActiveSheet.Protect Password:=drowssap

ActiveWorkbook.Protect Password:=drowssap

ThisWorkbook.Protect Password:=drowssap

Regards

Trevor
 
G

Guest

Im not a programmer so the help was a bit too confusing for me.
Ill copy in your syntax and see what happens. I assume drowssap is your
actual password ?
Thanks
 
T

Trevor Shuttleworth

Needs to be in quotes if it is the actual password ... my omission. Unless
you have a variable called drowssap with your password in it.

Yes, I'm sure the help on this used to be more simple than it is now.

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top