+ Reply to Thread
Results 1 to 13 of 13

Rookie Mistake (Password-related)

  1. #1
    Registered User
    Join Date
    08-22-2017
    Location
    Virginia, United States
    MS-Off Ver
    16.0.8326.2076
    Posts
    16

    Rookie Mistake (Password-related)

    I used this (very wrong) line of code to specify that I wanted to be able to format rows when protecting my worksheet with VBA:

    ActiveSheet.Protect (AllowFormattingRows = True)

    Instead of doing what I wanted it to do, it created a password for the worksheet. Can someone please tell me what password was created? I've tried several obvious versions of what's in parentheses, but to no avail.

    The PasswordBreaker macro that I'm familiar with doesn't seem to want to play nicely, and I'd rather not modify the XML, as it seems like a recipe for file corruption.

    All help appreciated!

    Thanks!

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,444

    Re: Rookie Mistake (Password-related)

    Hi there,

    The following code unprotected the worksheet for me:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M


    P. S. By the way, if you'd used "Option Explicit" at the top of the VBA CodeModule, your code would have generated a "Variable not defined" error and the code would not have run!
    Last edited by Greg M; 09-30-2020 at 01:46 PM. Reason: P. S. added

  3. #3
    Registered User
    Join Date
    08-22-2017
    Location
    Virginia, United States
    MS-Off Ver
    16.0.8326.2076
    Posts
    16

    Re: Rookie Mistake (Password-related)

    The simplicity of this answer is embarrassing... Thank you, Greg! Admittedly, my curiosity will still be wondering what the password was!

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,457

    Re: Rookie Mistake (Password-related)

    Not sure if this is considered hacking, but
    my curiosity will still be wondering what the password was!
    The answer is Logical.

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,444

    Re: Rookie Mistake (Password-related)

    Hi again,

    Many thanks for your feedback.

    You're welcome - glad I was able to help.

    Incidentally, the worksheet will be unprotected if you run:

    Please Login or Register  to view this content.
    but trying to unprotect it from the Ribbon "Unprotect Sheet" button will NOT work when you enter "False" (without quotes) as the password. It may be associated with "False" being treated as a Boolean variable in one instance and as a String variable in the other. I'm happy to be educated on this point.


    Best regards,

    Greg M

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,457

    Re: Rookie Mistake (Password-related)

    but trying to unprotect it from the Ribbon "Unprotect Sheet" button will NOT work when you enter "False" (without quotes) as the password.
    It will if you put it all in caps.

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,444

    Re: Rookie Mistake (Password-related)

    Hi Fluff,

    Now that IS a nasty trick!!!

    When I run the following code:

    Please Login or Register  to view this content.
    the message box displays "False" (without quotes), so it's a bit mean to have the password entered as "FALSE" (again without quotes)!


    Thank you for furthering my education.

    Regards,

    Greg M

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,457

    Re: Rookie Mistake (Password-related)

    I suspect it's because Excel uses TRUE & FALSE as boolean values, whilst VBA uses True & False.
    Just another thing to cause headaches.

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,444

    Re: Rookie Mistake (Password-related)

    Indeed so! Thanks again.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,457

    Re: Rookie Mistake (Password-related)

    My pleasure.

  11. #11
    Registered User
    Join Date
    08-22-2017
    Location
    Virginia, United States
    MS-Off Ver
    16.0.8326.2076
    Posts
    16

    Re: Rookie Mistake (Password-related)

    Bonus points to all! Thank you both!

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,457

    Re: Rookie Mistake (Password-related)

    Glad to help & thanks for the feedback.

  13. #13
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,444

    Re: Rookie Mistake (Password-related)

    Hi again,

    Many thanks for your feedback and also for the Reputation increase - much appreciated!

    You're welcome - glad I was able to help.

    Best regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. I want to extend related tables that have related formulas
    By earlyyyyyy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-10-2015, 10:08 AM
  2. [SOLVED] Macro only calculates on whole numbers!! im sure this is a rookie mistake.
    By alsyourpal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2013, 02:31 AM
  3. rookie
    By brobinson692 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-14-2013, 03:39 AM
  4. Rookie
    By Patrick.65 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-26-2013, 11:29 PM
  5. i am a rookie
    By kparacha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2007, 12:15 AM
  6. rookie
    By D-- in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2007, 12:49 PM
  7. Rookie needs help!
    By tbobo in forum Excel General
    Replies: 3
    Last Post: 03-22-2006, 05:10 PM

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