Password protect multiple excel sheet saved in same location by using VBA

AyeshaM

New Member
Joined
Apr 3, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
HI there,
I have 96 excel files saved in same location and same folder ( C Drive) . I would like to password protect these 96 files with the same password. Is there any VBA code that some one could share ( could you please explicitly mention what needs to be updated in that code for it to work). This would really save lot of my time. Thanks.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Welcome to the Board!

It sounds like you want to protect workbooks, not worksheets, so I don't think that previous link is what you want.
Also, you need to loop through all the files in a folder.

Have a look here: VBA Protect/Unprotect Workbook (Excel File)

There are two sections that you will want to focus on:
"Protect All the Closed Workbooks from a Folder"
That has most the code you need, except it does not show how to protect it using a password.
Have a look at the following section for that tweak:
"Protect a Workbook with Password"
 
Upvote 0
Yes, perhaps. Question title says "sheet", post says "files". Not really consistent or clear to me.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top