Abstract

Excel workbooks might contain sensitive information like bank account numbers, employee address, social security numbers, critical weekly reports or company’s financial reports. So, it is crucial to protect your Excel workbook.

In this article, you would learn to protect an excel file with a password. This can be achieved by using the native GUI method or a macro. So, now let’s see how this is done.

Password protect through the GUI

Level of difficulty: LOW

Option 1: Encrypt with Password

Step 1: From the File Menu, click Protect Workbook under Info. Then click on Encrypt with Password.

Step 2: This will bring up a dialog box with the title “Encrypt Document”. Within this dialog box, click on the text field with the title “Password” and then type your password. Do note that there are character limitations for this password field. Maximum allowed character count is 255. The encryption used in this feature is 128-bit AES advanced encryption.

Step 3: After typing the password, press OK on the dialog box. Now you will see another dialog box asking you to retype the password. This is to confirm your password correctly.

Step 4: If you type in a wrong password, excel will display a message box with the following text “Confirmation password is not identical”. If you type the correct password, the dialogue box will disappear. The option “Encrypt with Password” would now be highlighted in Grey. This shows that your Excel file is now encrypted with a password.

How To Password Protect An Excel File 1

.

How To Password Protect An Excel File Option 2: Protect Workbook structure

Step 1: From the File Menu, click on Protect Workbook under Info and then click on Protect Workbook Structure.

Step 2: You would immediately see a dialog box where you can enter a password. Unlike the former method “Encrypt with Password”, it is not compulsory to type in a password. You can leave the password field empty and click OK.

 Don’t forget to check the “Structure” option. This helps you to prevent unwanted changes to the workbook’s structure. If the workbook’s structure is protected, users cannot add/delete sheets from the workbook.

How To Password Protect An Excel File 2

Option 3: Protect and control the access to read or modify

This option is available under “Save” and “Save As”.

Step 1: When you save your file you will be able to see the link “More Options”. Click on it.

Step 2: Once you click on ‘More Options’, a dialog box will open. Click on Tools and select General Options.

Step 3: You will now be prompted to enter a password. There would be two password fields. The first password field is used to restrict users from opening the file. The second password field is used to restrict users from modifying the file.

Step 4: The next step would be to enter the password. You should enter the password once again to confirm.

Step 5: Your workbook is now protected. Whenever users try to open your workbook, they have to type in the password to access or modify it.

Step 6: If you check the option “Always create backup”, a backup file would be created in the same path of your source file. The naming convention is “Backup of % your source file name % .xlk”

How To Password Protect An Excel File ? When you try to open the backup file, you will still have to use the password to unlock it. Though the backup file is created by Excel, you will still see “The file format and extension don’t match” warning. Click Yes and you can open the backup file.

How To Password Protect An Excel File Password protect through VBA

Level of difficulty: Medium

In this method, you will have to paste a snippet of code into a new module in the VBA editor and execute it. This macro will show a dialog box and prompt you to enter a password. Enter your password and press OK.

Your workbook is now password protected but not saved. When you try to save your workbook, you can continue to save it as a macro free workbook.

Password in this script is an optional variable. The password string is case sensitive. However, if you leave the password field blank, your workbook can be unprotected with a blank password.

The option “Structure := True” implies that the structure of your workbook would be protected. The default value for this option is False. So it is necessary to mention ‘True’ explicitly.

How To Password Protect An Excel File Script can be modified:

This script protects your active workbook. You can modify this script by including folder browser function and allowing the users to select a folder. The script can be revised to read all excel files in the selected folder and enable password protection in all files or in a group of files.

Don’t lose the Password:

Do not lose or forget the password that you use for protecting your excel files because it cannot be recovered. Also, please do note that the password used to protect your excel files are case sensitive.

Please note, this guide applies to Excel 2016 and might vary across versions of Excel.