Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Adding a Little Animation to Your Life
Converting a Range of URLs to Hyperlinks
Making the Formula Bar Persistent
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:
http://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.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2878) applies to Microsoft Excel versions: 97 2000 2002 2003 2007
A Picture is Worth Thousands! Your worksheets are not limited to holding numbers and text. You can also add graphics or easily create charts based on your data. Excel Graphics and Charts, available in two versions, helps you make your graphics and charts their absolute best.