Closed Thread
Results 1 to 3 of 3

Unprotecting sheet w/ workbook shared & Protected

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Unprotecting sheet w/ workbook shared & Protected

    Here's my dilemma;

    I have a workbook which has a hidden worksheet where a password resides. My macro goes to this worksheet, collects the password and comes back to the current worksheet, unprotects it (with that password), imports data, and then reprotects the worksheet. Because the workbook is also protected, the sheet with the hidden password cannot be accessed.

    Now I want the workbook to be "shared and protected" with "Track Changes". This will prevent the macro itself from being tampered with and will enable an audit trail of sorts on a 3rd worksheet within the workbook.

    However, if the workbook is shared and protected, one needs to unshare and unprotect it first before unprotecting the worksheet that I need to import into. Sooooooooo,

    I need to figure out how to (in VB) have the macro first unprotect and unshare the workbook (using the hidden password), then unprotect the worksheet (got that part figured out already), then reprotect the worksheet and the shared workbook. Any ideas on how I would do that?

    I can send the current macro to those who wish to investigate.

    Is there another way to protect the macros from being edited by someone with rights to the workbook?

    Thanks in advance
    ChemistB

  2. #2
    Registered User
    Join Date
    11-13-2006
    Posts
    1
    i think this is what you mean:

    open vba editor. then: tools\vbaproject properties

    select the protect tab, enter a password, save and close

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Unprotecting sheetw/ workbook shared

    Thanks for the response Eemanresu

    I do need to clarify what I need. I am also unclear as to what the solution you suggested results in. I did what you suggested on one of my macroed workbooks (locking from Visual Basic properties) but don't see any differences in my spreadsheet (i.e. I was still able to go in and modify my macro without a password). What does this lock enable? Thanks

    Now a clarification on what I am doing....

    I import data to a locked spreadsheet and then relock the sheet so that it cannot be edited. I do this by;
    1. The macro goes to a hidden spreadsheet in the workbook and collects a password which it associates with Variable "PWORD". It then unlocks the sheet;

    Sheets("Raw Data").Select
    ActiveSheet.Unprotect Password:=PWORD


    2. After importing the file, it relocks the sheet;

    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:=PWORD

    I want this workbook to be shared and protected. Unfortunately, if it is, then the workbook-share password must be removed before the macro can unprotect the worksheet. What would be the visual basic code to do this (if it's possible)? If anyone needs a copy of my macro to better understand this, let me know. Thanks

    ChemistB

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1