+ Reply to Thread
Results 1 to 11 of 11

No password asked when using VBA to protect Sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Exclamation

    Quote Originally Posted by royUK
    AFAIK a password set in VBA will still prompt for a password when manually unprotecting the sheet.
    Hi royUK,

    For some strange reason it is not prompting me when I manually unprotect the sheet. I thought the same as you that when you protect a sheet in VBA Excel should still prompt you for a password when unprotecting a sheet manually.
    Best Regards.

    Michael
    -----------------------------------
    Windows Vista, Microsoft Office 2007

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've never come across this, maybe you can attach your workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Smile

    Hi royUK,

    I have done a test sheet with the exact code that I have used. I hope you can figure it out.

    I manually set the password as "pw" in the tools menu, you will also see this in the code in Module1 when it unprotects and then re-protects the worksheet.

    I hope you can figure this out for me.

    Thanks.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I gat a prompt for the password using your workbook.

  5. #5
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Smile

    Quote Originally Posted by royUK
    I gat a prompt for the password using your workbook.
    I get a prompt only if I unprotect the sheet without using the VBA code.

    However if I use the 'CTRL+SHIFT+S' to which if you look at it unprotects the sheet and then once the code runs in protects the sheet again. However once you now unprotect the sheet via the Tool menu the prompt does not pop up.

    I have now confirmed this on my home pc as well as my work pc. Did you run the code with the shortcut key?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I did use the short cut.

  7. #7
    Forum Contributor
    Join Date
    03-30-2007
    Location
    London, UK
    MS-Off Ver
    Microsoft Office 2007
    Posts
    317

    Smile

    Quote Originally Posted by royUK
    I did use the short cut.
    This is really strange, I can't understand why the prompt does not come up for me once I run the code.

    I have the 'Analysis ToolPak' installed but I wouldn't have thought that would interfere with the password system.

+ 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