Protected sheets in excel

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

Protected sheets in excel

Post by snapper1969 » Thu Oct 23, 2008 3:23 pm

Hi,

I have an excel worksheet that has 12 dates in various cells, this worksheet is protected. Would it be possible to use MS to create an app that asked the user for 12 dates that would populate the relevant cells in the protected worksheet?. Can you unprotect the worksheet via MS and re-protect at the end of the program?.

Thx,

John

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Oct 23, 2008 3:36 pm

Yes. Call Unprotect method of workbook or worksheet object:

WorkBookObj.Unprotect "password"

Protect again later with:

WorkBookObj.Protect "password"

You can use Input or a custom dialog to query the data from the user.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

Post by snapper1969 » Thu Oct 23, 2008 3:46 pm

Thx Marcus...It is also hidden..Can I do WorkBookObj.Unhide and do I need to ??

Thx,

John

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Oct 23, 2008 3:55 pm

Set the worksheets visible property.

These aren't really Macro Scheduler questions. They are Excel VBA questions. I'm answering them by using Google:
http://www.google.com/search?q=vba+unhide+a+sheet

My following post explains how to convert from VBA to VBScript:
http://www.mjtnet.com/blog/2008/04/28/c ... -vbscript/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts