+ Reply to Thread
Results 1 to 3 of 3

Protecting Workbook w/ password using VBA

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Protecting Workbook w/ password using VBA

    Hi Everyone,

    I reuqire my macro to unhide some sheets to pull the data from before hiding the sheets so that no body has unrestricted access to that data...

    I have been doing it like this:

    Please Login or Register  to view this content.
    and it works great, however, I now want to protect the work book, and I can't work out how to get the password into the VBA script for both unhiding and hiding purposes.

    Any ideas???


    Regards,

    Steve

  2. #2
    Registered User
    Join Date
    06-03-2009
    Location
    Tulsa, OK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Protecting Workbook w/ password using VBA

    Use the code
    Please Login or Register  to view this content.
    where the "..." is the name of the workbook and "X" is the password used to protect it.

    hope this helps

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,165

    Re: Protecting Workbook w/ password using VBA

    You can create a worksheet (in this example Sheet4), set it to "XLSheetVeryHidden" and store the password in cell "A1"
    Please Login or Register  to view this content.
    Set sheet4 cell A1 text to a desired password.
    Regards

    Rick
    Win10, Office 365

+ Reply to 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