+ Reply to Thread
Results 1 to 11 of 11

Modify Password change all files in folders and subfolders, read only recommended

  1. #1
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Modify Password change all files in folders and subfolders, read only recommended

    Hey,

    I have a folder contain subfolders that have multiple files all containing the same password and same settings.
    Password to modify and the box ticked for read only recommended. No password to open.

    I would like to change the password all of these files.

    The only answers i can find for similar questions are to change just the password for opening and not applying any read only recommended options either.

    If this is possible and someone can help this would be much appreciated!

    Thanks in advance.

    Marcosis

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Possibly...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102
    Quote Originally Posted by dangelor View Post
    Possibly...
    Please Login or Register  to view this content.
    Hey, thanks for the response. Is that supposed to go into the module of a new workbook?

    If so nothings happening. It doesn't fail, it just does nothing. Any help would be appreciated

    Cheers

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Modify Password change all files in folders and subfolders, read only recommended

    It would go into a standard code module of the workbook of your choice, saved as an .xlsm or .xlsb file format.

    As to it doing something, it should change the password in your files from the 'old' to the 'new' password.

    Before you run the code, be sure to change the 3 bolded variables in the code to match your situation.

    When the code finishes running, check to see if you can open your files using the new password.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by dangelor; 06-08-2021 at 06:45 AM. Reason: Added updated code

  5. #5
    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
    48,238

    Re: Modify Password change all files in folders and subfolders, read only recommended

    I would urge you to back up your files before you attempt anything ... just in case.
    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


  6. #6
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Quote Originally Posted by dangelor View Post
    It would go into a standard code module of the workbook of your choice, saved as an .xlsm or .xlsb file format.

    As to it doing something, it should change the password in your files from the 'old' to the 'new' password.

    Before you run the code, be sure to change the 3 bolded variables in the code to match your situation.

    When the code finishes running, check to see if you can open your files using the new password.
    Worked like an absolute dream!

    Cheers dude!

  7. #7
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Glad I could help!

  8. #8
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Quote Originally Posted by dangelor View Post
    Glad I could help!
    Hey!

    So i jumped the gun a bit haha!

    I tested it on 6 spreadsheets and it worked great.

    I just tried to run it on the ones that i needed which, at the time, i didnt realise that it was 1008 spreadsheets! My colleague didnt warn me.

    It changed alot of them, but threw up an error, saying it could access one of them. Maybe he didnt set the correct password for example.

    Is there a way to add something like On Error Resume Next somewhere. I only found that with some research, but wasnt sure if that was the correct way to go about it.

    The other thing was that some of the files are .xlsx , so could it be changed to look for anything containing *.xls* for example, because looking at the code you provided, it looks at the last 4 characters for that, but if i change it, it throws up an error about the others.

    So to round up, it would be great if it could ignore errors and move on (the dream being it listing the files causing the issue) but if thats a pain, not a problem.

    And to also search for files containing xls

    Cheers

  9. #9
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Please don't quote entire posts unnecessarily. They clutter threads and make them hard to read.
    Use the "Quick reply" instead
    Thanks

  10. #10
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Modify Password change all files in folders and subfolders, read only recommended

    My bad!

    Cheers

  11. #11
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Modify Password change all files in folders and subfolders, read only recommended

    Try this version...
    Please Login or Register  to view this content.

+ 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. Copy List of Folders, Subfolders and Files to New Location
    By MusicMan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-23-2021, 09:09 AM
  2. copy or cut pdf files from folders and subfolders into one single folder
    By druva in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2019, 01:27 PM
  3. [SOLVED] loop trough all folders and subfolders and merge pdf files
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-25-2018, 05:54 AM
  4. how to copy and paste folders / subfolders and files
    By ColemanJames in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2018, 07:32 PM
  5. [SOLVED] Search for files in folders and subfolders
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-16-2014, 08:43 AM
  6. [SOLVED] Map/List of folders, subfolders & files
    By Bogdan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2006, 01:10 PM
  7. Change Read-Only Recommended Prompt
    By brookly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2006, 02:15 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