+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Password Mismatch in macro

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

    Password Mismatch in macro

    With Excel 2000, I used the following line of code to allow Excel to run macros on the protected spreadsheet. The password in the line of code did not have to match the password used to protect the sheet (which often changes).
    Please Login or Register  to view this content.
    In Excel 2007, it gives me an Incorrect Password error, implying that the macro password must match the sheet password?
    Thanks in advance?
    Last edited by ChemistB; 05-07-2009 at 01:32 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

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

    Re: Password Mismatch in macro

    I'm amazed you don't have to match the password in any version of Excel, Chemist. Otherwise, you're changing the password without knowing the old one.

    Very curious.



    You sure about that?
    Entia non sunt multiplicanda sine necessitate

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

    Re: Password Mismatch in macro

    Yep, positive. I figured that was one of the reasons why Excel is not considered Part 11 compliant as that creates a huge gap for anyone knowing VBA. If the spreadsheet wasn't protected when the macro was run, the code would run through and then it would assign the password in the code (e.g. "testing") but if it was already protected, the code would run fine and the sheet password would remain unchanged. The code would not run without that line however.

    Okay, this makes things more complicated but not impossible. I'll need to have the password on a very hidden sheet and refer to that password in the code. Thanks SHG.

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

    Re: Password Mismatch in macro

    You can embed the password in a public constant in the code ...

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

    Re: Password Mismatch in macro

    I could but the passwords are enabled by our Document Group who are not very Excel savy. Thanks again.

+ 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