+ Reply to Thread
Results 1 to 6 of 6

Open Password Protected Workbooks in a Folder Through a Macro

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    D
    MS-Off Ver
    Excel 2010
    Posts
    17

    Open Password Protected Workbooks in a Folder Through a Macro

    Hey Guys,

    I have a workbook full of password protected files (all different passwords.) I have a main excel file that contains the passwords for each of these files. What I would like this macro to do is to read the password for each file and open the files from the folder. So For instance this is how the password excel file would look:
    A B
    File XXX Password XXX
    File YYY Password YYY

    Thus, what I would like is for the macro to read the file name from column A and then open that file and input password that is in column B into the password prompt. Please let me know if this is doable?

    Thanks

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Open Password Protected Workbooks in a Folder Through a Macro

    Help me to understand the need for passwords, if when you open the file, it automatically gets the password and unlocks the file?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-14-2013
    Location
    D
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open Password Protected Workbooks in a Folder Through a Macro

    Yeah basically I have 20+ files in a folder and they all have separate passwords (they are confidential files.) Thus, instead of opening each file separately and entering in the password in each, I want to automate this process. Unfortunately, each file has a separate password that is stored in an excel sheet and these passwords change every year so I want to make it so that it reads from this file so that the macro is always relevant. Let me know if that makes sense.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Open Password Protected Workbooks in a Folder Through a Macro

    Hi aditya88,

    Try the attached file. Full code follows.

    Lewis

    Please Login or Register  to view this content.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Open Password Protected Workbooks in a Folder Through a Macro

    Quote Originally Posted by aditya88 View Post
    Yeah basically I have 20+ files in a folder and they all have separate passwords (they are confidential files.) Thus, instead of opening each file separately and entering in the password in each, I want to automate this process. Unfortunately, each file has a separate password that is stored in an excel sheet and these passwords change every year so I want to make it so that it reads from this file so that the macro is always relevant. Let me know if that makes sense.
    That still does not explain why, if you want to open them anyway, you would need them to be PW protected?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    08-14-2013
    Location
    D
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Open Password Protected Workbooks in a Folder Through a Macro

    Hey Lewis,

    Thanks a lot for all your help, that worked like a charm! I need to make some small tweaks to suit my needs, but you've done all the grunt work. I really appreciate it.

    FDibbins - reason I want them to be PW Protected is that all of these files are in our departments folder at work and only a select few should be able to access it, thus the files need to be password protected at all times.

    Thanks,

    Aditya

+ 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] Open password protected files in folder using list of passwords
    By Shift-4 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-22-2013, 06:08 PM
  2. [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
  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. [SOLVED] Making Folder Password Protected using Macro???
    By jesika in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2009, 07:41 AM
  5. macro to batch fix errors on password protected workbooks
    By spence in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-07-2005, 12:05 AM

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