Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Protecting an Entire Folder of Workbooks.

Protecting an Entire Folder of Workbooks

Written by Allen Wyatt (last updated October 28, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Mahesh has a number of Excel workbooks, all stored in the same folder. He wonders if it is possible to assign a password to the entire folder so that all the workbooks are protected.

The short answer is no, you can't do that in Excel. There are a number of different techniques you can apply that will provide the desired result, however. The first method is to use a program such as WinZip to combine all the workbooks into a single zip file. This file can be password protected (in WinZip) so that not everyone can open it. You could then open the zip file (using your password) and double-click on any workbook in it in order to modify it with Excel. The result, for all intents and purposes, is that you have a "folder" (the zip file) that is protected, while the individual files it contains are not.

Another approach is to place the workbook folder on a network drive and then have the network admin protect the folder. Most network operating systems allow administrators to control who can have access to specific folders and their contents.

A third approach is to use a third-party program to protect the folder. A quick search of the Web will no doubt turn up several candidates, such as the following:

https://www.folder-password-expert.com

You can also use an Excel macro to protect the workbooks. While it does not offer true folder-level protection, it does allow you to protect all the workbooks in the folder in as easy a manner as possible.

Sub ProtectAll()
    Dim wBk As Workbook
    Dim sFileSpec As String
    Dim sPathSpec As String
    Dim sFoundFile As String

    sPathSpec = "C:\MyPath\"
    sFileSpec = "*.xls?"

    sFoundFile = Dir(sPathSpec & sFileSpec)
    Do While sFoundFile <> ""
        Set wBk = Workbooks.Open(sPathSpec & sFoundFile)
        With wBk
            Application.DisplayAlerts = False
            wBk.SaveAs FileName:=.FullName, _
              Password:="swordfish"
            Application.DisplayAlerts = True
        End With
        Set wBk = Nothing
        Workbooks(sFoundFile).Close False
        sFoundFile = Dir
    Loop
End Sub

Make sure you change the sPathSpec and sFileSpec variables, near the beginning of the code, to reflect the folder containing the workbooks and the pattern for the names of the workbooks you want protected. The macro assumes that all the workbooks are unprotected; if any are not, the macro will prompt for the workbook's password.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12638) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Protecting an Entire Folder of Workbooks.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Hiding and Unhiding Worksheets

Worksheets are easily accessible in a workbook, but you may not want them to be so open. You can hide worksheets so they ...

Discover More

Removing Tabs Used to Indent a Paragraph

You get a document from a colleague and you notice that each paragraph starts with a tab character. Here are a couple of ...

Discover More

Searching for Text that Doesn't End a Paragraph

The Find and Replace capabilities of Word are very powerful, particularly if you are using wildcards in your search. ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Always Opening a Workbook that is Editable

When you send a workbook to a coworker, it can be bothersome if that person has problems using what you created. There is ...

Discover More

Saving a Workbook Using Passwords

If you want to protect your workbook so that others cannot open or change the information it contains, an easy way to ...

Discover More

Changing a Workbook Password

Excel allows you to apply protection to your workbooks. If you want to later change the passwords associated with that ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.