+ Reply to Thread
Results 1 to 15 of 15

Open password protected files in folder using list of passwords

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Open password protected files in folder using list of passwords

    I want to run a macro that simply unprotects all files in a folder, saves and closes. I have the passwords and related file names and paths in a list.


    This is the macro that sets the passwords based on the list

    Please Login or Register  to view this content.
    Now I want to figure out away to reverse engineer that code so it will unprotect all the workbooks and save and close them as unprotected.

    Thanks



    Edit: I should also add that it is not necessary to have new macro based on that code above. I will be happy with any code that gets the job done.
    Last edited by Shift-4; 07-22-2013 at 06:01 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    You should be able to use very similar code.

    Take a look at the parameters for Workbook.Open ... one of them is the password.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    Quote Originally Posted by TMShucks View Post
    You should be able to use very similar code.

    Take a look at the parameters for Workbook.Open ... one of them is the password.


    Regards, TMS
    I agree but I can't figure it out. I am quite the novice with VBA
    I would be happy with any solution. The solution doesn't have to be based on the code I listed.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    Thanks

    I will try to apply that to what I have.

    I think I will have to manipulate your suggestion as the password comes from a list.


    Edit: Each file has a unique password

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    Should look something like:

    Please Login or Register  to view this content.

    Regards, TMS

  7. #7
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    Quote Originally Posted by TMShucks View Post
    Should look something like:

    Please Login or Register  to view this content.

    Regards, TMS
    Thanks! It works

    I do get a runtime error 1004 at the end though.
    It says " could not be found.
    Anyway of correcting that?

    I noticed it happens on my original macro that sets the passwords too (didn't notice it before).

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    You're welcome. Thanks for the rep.

    You possibly have a space in the last cell rather than a file name.





    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  9. #9
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    It's not a space causing the runtime error

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    Please post a sample workbook.


    Regards, TMS

  11. #11
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    I hope this works


    Unlock files macro.xlsm

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: Open password protected files in folder using list of passwords

    The last row doesn't have a space, fair enough. However, in the sample workbook provided, rows 38 to 44 are blank. Looks as though you never actually get to the end of the list.

    Change the code to this and it should cope with gaps in the list.

    Please Login or Register  to view this content.

    Note that your original code will need adjustment too ... or just make sure there are no gaps.


    Regards, TMS

  13. #13
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    Sorry about that gap
    Don't have those files back yet so there is nothing to lock/unlock :D

    I will give this a try

    Thanks

  14. #14
    Registered User
    Join Date
    06-18-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open password protected files in folder using list of passwords

    It works perfectly.
    I need to remember If/End If and try and apply that in the future

    Thank you very much

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,297

    Re: [SOLVED] Open password protected files in folder using list of passwords

    You'e welcome.

+ 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. [SOLVED] Password array to open all password protected workbook in a folder
    By rename in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-07-2012, 05:06 AM
  2. ByPassing Passwords when pulling stats from external password-protected files
    By jameztown in forum Excel Programming / VBA / Macros
    Replies: 35
    Last Post: 05-27-2010, 02:36 PM
  3. How to make Workbooks.Open skip password protected files
    By hoffey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2009, 11:01 AM
  4. open multiple password protected files
    By blackstar in forum Excel General
    Replies: 0
    Last Post: 05-13-2007, 11:56 PM
  5. Replies: 2
    Last Post: 04-15-2005, 12:06 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