+ Reply to Thread
Results 1 to 11 of 11

VBA Password not working

  1. #1
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    VBA Password not working

    How do i set a password on VBA so it cant be opened without the password?

    I Have a spread sheet and at the moment i have done Alt + F11, I then right click on the work book and in the properties select protection and enter a password, But when i try to Alt +F11 again it just lets me straight in without asking for a password?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: VBA Password not working

    Try...

    Alt + F11
    Highlight VBAProject on left side of screen
    Tools >> VBAProject Properties >> Protection tab
    Check >> Lock project for viewing
    Enter password >> confirm password >> Ok
    Alt + Q and then reopen the VBE Alt + F11
    Double click on VBAProject left side of screen and you should be prompted for a password

    http://www.ozgrid.com/VBA/protect-vba-code.htm
    Last edited by jeffreybrown; 11-29-2011 at 11:11 AM.
    HTH
    Regards, Jeff

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Password not working

    You need to save & close the workbook as well. On re-opening the password prompt should work
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    Re: VBA Password not working

    Hi

    yes that is similar to what i was doing and for some reason it doesn't work?

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: VBA Password not working

    Make sure you save, close & reopen the workbook as RoyUK has pointed out...

  6. #6
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    Re: VBA Password not working

    Hi No I have tried that too and it still wont work?

  7. #7
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    Re: VBA Password not working

    I have just tried this and checked it again, I have put the password in saved it on the vba page saved on the spread sheet page and then re checked on the vba code the password is still there.

    When i then close and open it, if i go to properties there is no password on the protection tab?

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA Password not working

    Just so we're clear ...

    You password-protect a VBA Project in a workbook, not the VBE. So you select a particular project in the Project Explorer window, apply a password, then save, close, and reopen the workbook.

    You can still open the VBE and view unprotected projects, but if you select the protected VBA project, you'll be prompted for the password.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: VBA Password not working

    hi,
    do you have any code in yr wkb? a userform, a combobox or something?
    try to add something and do what jeffrey said.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  10. #10
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    Re: VBA Password not working

    i will try this again.

  11. #11
    Registered User
    Join Date
    02-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: VBA Password not working

    I had the same problem as gjjh25.
    Adding a bit of code resolved the problem.
    Thanks john55!

+ 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