Chapter 31. Protecting Your Work

<feature><title>In This Chapter</title> </feature>

The concept of “protection” gets a lot of attention in the Excel newsgroups and forums. It seems that many users want to learn how to protect their workbooks from being copied or modified. Excel has several protection-related features, and those features are covered in this chapter.

Types of Protection

Excel’s protection-related features fall into three categories:

  • Worksheet protection: Protecting a worksheet from being modified, or restricting the modifications to certain users.

  • Workbook protection: Protecting a workbook from having sheets inserted or deleted, and also requiring the use of password in order to open the workbook.

  • VB protection: Using a password to prevent others from viewing or modifying your VBA code.

Caution

Before I discuss these features, you should understand the notion of security. Using a password to protect some aspect of your work doesn’t guarantee that it’s secure. Password-cracking utilities (and some simple tricks) have been around for a long time. Using passwords work in the vast majority of cases, but if someone is truly intent on getting to your data, he or she can usually find a way. If absolute security is critical, perhaps Excel isn’t the proper tool.

Worksheet Protection

Excel users protect a worksheet for a variety of reasons. One reason is to prevent yourself or others from accidentally deleting formulas or other critical data. A common scenario is to protect a worksheet so that the data can be changed, but the formulas can’t be changed.

To protect a worksheet, activate the worksheet and choose Review Worksheet Protection Changes Worksheet Protection Protect Sheet. Excel displays the Protect Sheet dialog box shown in Figure 31.1. Note that providing a password is optional. If you enter a password, that password will be required to unprotect the worksheet. If you accept the default options in the Protect Sheet dialog box, none of the cells on the worksheet can be modified.

Use the Protect Sheet dialog box to protect a worksheet.

Figure 31.1. Use the Protect Sheet dialog box to protect a worksheet.

Unlocking cells

In many cases, you will want to allow some cells to be changed when the worksheet is protected. For example, your worksheet may have some input cells that are used by formula cells. In such a case, you would want the user to be able to change the input cells, but not the formula cells. Every cell has a Locked attribute, and that attribute determines whether the cell can be changed when the sheet is protected.

By default, all cells are locked. To change the locked attribute, select the cell or range and then use the Protection tab of the Format Cells dialog box (see Figure 31.2). To display this dialog box, right-click the cell or range and choose Format Cells from the shortcut menu (or press Ctrl+1). Remove the check mark from Locked and click OK.

Use the Protection tab in the Format Cells dialog box to change the Locked attribute of a cell or range.

Figure 31.2. Use the Protection tab in the Format Cells dialog box to change the Locked attribute of a cell or range.

Note

The Protection tab of the Format Cells dialog box has another attribute: Hidden. If checked, the contents of the cell don’t appear in the Formula bar when the sheet is protected. The cell isn’t hidden in the worksheet. You may want to set the Hidden attribute for formula cells to prevent users from seeing the formula when the cell is selected.

After you unlock the desired cells, choose Review Note Changes Note Protect Sheet to protect the sheet. After doing so, you can change the unlocked cells, but if you attempt to change a locked cell, Excel displays the dialog box shown in Figure 31.3.

Excel warns you if you attempt to change a locked cell.

Figure 31.3. Excel warns you if you attempt to change a locked cell.

To unprotect a protected sheet, choose Review Excel warns you if you attempt to change a locked cell. Changes Excel warns you if you attempt to change a locked cell. Unprotect Sheet. If the sheet is protected with a password, you’re prompted to enter the password.

Sheet protection options

The Protect Sheet dialog box has several options, which determine what the user can do when the worksheet is protected.

  • Select locked cells: If checked, the user can select locked cells using the mouse or the keyboard. This setting is checked, by default.

  • Select unlocked cells: If checked, the user can select unlocked cells using the mouse or the keyboard. This setting is checked, by default.

  • Format cells: If checked, the user can apply formatting to locked cells.

  • Format columns: If checked, the user can hide or change the width of columns.

  • Format rows: If checked, the user can hide or change the height of rows.

  • Insert columns: If checked, the user can insert new columns.

  • Insert rows: If checked, the user can insert new rows.

  • Insert hyperlinks: If checked, the user can insert hyperlinks (even in locked cells).

  • Delete columns: If checked, the user can delete columns.

  • Delete rows: If checked, the user can delete rows.

  • Sort: If checked, the user can sort data in a range (as long as the range doesn’t contain any locked cells).

  • Use AutoFilter: If checked, the user can use existing autofiltering.

  • Use PivotTable reports: If checked, the user can change the layout of pivot tables or create new pivot tables.

  • Edit objects: If checked, the user can make changes to objects (such as Shapes) and charts, as well as insert or delete comments.

  • Edit scenarios: If checked, the user can use scenarios (see Chapter 36).

Tip

When the worksheet is protected and the Select Unlocked Cells option is set, pressing Tab moves to the next unlocked cell, making data entry much easier.

Assigning User Permissions

Excel also offers the ability to assign user-level permissions to different areas on a protected worksheet. You can specify which users can edit a particular range while the worksheet is protected. As an option, you can require a password to make changes.

This feature is rarely used, and the setup procedure is rather complicated. But if you need this level of protection, setting it up is worth the effort to get it.

Start by unprotecting the worksheet if it’s protected. Then choose Review Assigning User Permissions Changes Assigning User Permissions Allow Users To Edit Ranges, which displays the dialog box shown in Figure 31.4. Then follow the prompts in the series of dialog boxes that follow. Make sure that you protect the sheet as the final step.

The Allow Users To Edit Ranges dialog box.

Figure 31.4. The Allow Users To Edit Ranges dialog box.

Workbook Protection

Excel provides three ways to protect a workbook:

  • Require a password to open the workbook

  • Prevent users from adding sheets, deleting sheets, hiding sheets, and unhiding sheets

  • Prevent users from changing the size or position of windows

I discuss each of these methods in the sections that follow.

Requiring a password to open a workbook

Excel lets you save a workbook with a password. After doing so, whoever tries to open the workbook must enter the password.

To add a password to a workbook:

  1. Choose Office Requiring a password to open a workbook Prepare Requiring a password to open a workbook Encrypt Document. Excel displays the Encrypt Document dialog box shown in Figure 31.5.

    Specify a workbook password in the Encrypt Document dialog box.

    Figure 31.5. Specify a workbook password in the Encrypt Document dialog box.

  2. Type a password and click OK.

  3. Type the password again and click OK.

  4. Save the workbook.

Note

You need to perform these steps only one time. You don’t need to specify the password every time you resave the workbook.

To remove a password from a workbook, repeat the same procedure. In Step 2, however, delete the existing password symbols from the Encrypt Document dialog box, click OK, and save your workbook.

Figure 31.6 shows the Password dialog box that appears when you try to open a file saved with a password.

This workbook requires a password.

Figure 31.6. This workbook requires a password.

Excel provides another way to add a password to a document:

  1. Choose Office This workbook requires a password. Save As.

  2. In the Save As dialog box, click the Tools button and choose General Options. Excel displays the General Options dialog box.

  3. In the General Options dialog box, enter a password in the Password to Open field.

  4. Click OK. You’re asked to re-enter the password before you return to the Save As dialog box.

  5. In the Save As dialog box, make sure that the filename, location, and type are correct and then click Save.

Note

The General Options dialog box has another password field: Password to Modify. If you specify a password for this field, the file opens in read-only mode (it can’t be saved under the same name) unless the user knows the password. If you use the Read-Only Recommended check box without a password, Excel suggests that the file be opened in read-only mode, but the user can override this suggestion.

Protecting a workbook’s structure

To prevent others (or yourself) from performing certain actions in a workbook, you can protect the workbook’s structure. When a workbook’s structure is protected, the user may not

  • Add a sheet

  • Delete a sheet

  • Hide a sheet

  • Unhide a sheet

  • Rename a sheet

  • Move a sheet

To protect a worksheet’s structure:

  1. Choose Review Protecting a workbook’s structure Changes Protecting a workbook’s structure Protect Workbook to display the Protect Workbook dialog box (see Figure 31.7).

    The Protect Workbook dialog box.

    Figure 31.7. The Protect Workbook dialog box.

  2. In the Protect Workbook dialog box, place a check mark next to Structure.

  3. Enter a password, if desired.

  4. Click OK.

To unprotect the workbook’s structure, choose Review The Protect Workbook dialog box. Changes The Protect Workbook dialog box. Unprotect Workbook. If the workbook’s structure was protected with a password, you are prompted to enter the password.

Protecting a workbook’s windows

To prevent others (or yourself) from changing the size or position of a workbook’s windows, you can protect the workbook’s windows:

  1. Choose Review Protecting a workbook’s windows Changes Protecting a workbook’s windows Protect Workbook.

  2. In the Protect Workbook dialog box, place a check mark next to Windows.

  3. Enter a password, if desired.

  4. Click OK.

When a workbook’s windows are protected, the user can’t change anything related to the window size or position. For example, if the workbook window is maximized when the windows are protected, the user cannot unmaximize the window. The windows can, however, be zoomed.

To unprotect the workbook’s windows, choose Review Protecting a workbook’s windows Changes Protecting a workbook’s windows Unprotect Workbook. If the workbook’s windows were protected with a password, you are prompted to enter the password.

VB Project Protection

If your workbook contains any VBA macros, you may want to protect the VB Project to prevent others from viewing or modifying your macros. Another reason to protect a VB Project is to prevent its components from being expanded in the VB Editor Project window (which can avoid clutter while you’re working on other VB project). To protect a VB Project:

  1. Activate the VB Editor.

  2. Select your project in the Projects window.

  3. Choose Tools - xxxx Properties (where xxxx corresponds to your Project name). Excel displays the Project Properties dialog box.

  4. In the Project Properties dialog box, click the Protection tab (see Figure 31.8).

    Protecting a VB Project with a password.

    Figure 31.8. Protecting a VB Project with a password.

  5. Place a check mark next to Lock project for viewing.

  6. Enter a password (twice).

  7. Click OK and then save your file. When the file is closed and then re-opened, a password will be required to view or modify the VBA code.

Cross-Ref

Part VI discusses VBA macros.

Related Topics

This section covers additional topics related to protecting and distributing your work.

Saving a workbook as a PDF file

You can download a free Office 2007 add-in that enables you to save a workbook as a PDF file. Because of a legal dispute with Adobe Systems, Microsoft is not able to ship this add-in with Office 2007. You can download the add-in from:

http://office.microsoft.com/downloads

The PDF (Portable Document Format) file format is widely used as a way to present information in a read-only manner, with precise control over the layout. Software to display PDF files is available from a number of sources. Excel (with the assistance of the add-in) can create PDF files, but it cannot open them.

After installing the add-in, you can save your workbook in PDF or XPS format by choosing Office Saving a workbook as a PDF file Save As Saving a workbook as a PDF file PDF Or XPS. Excel displays its Publish As PDF Or XPS dialog box, in which you can specify a filename and location and set some other options.

Note

XPS is another “electronic paper” format, developed by Microsoft as an alternative to the PDF format. At this time, there is very little third-party support for the XPS format.

Marking a workbook final

Excel lets you mark a document as “final.” This action makes two changes to the workbook:

  • It makes the workbook read-only so that the file can’t be saved using the same name.

  • It makes the workbook view-only so that nothing may be changed. When you open a finalized document, the status bar displays an additional icon. You’ll find that most of the Ribbon commands are grayed out.

To finalize a workbook, choose Office Marking a workbook final Prepare Marking a workbook final Mark As Final. Excel displays a dialog box so that you can confirm your choice.

New Feature

Finalizing a workbook is a new feature in Excel 2007.

Caution

Marking a document as final is not a security measure. Anyone who opens the workbook can choose Office Caution Prepare Caution Mark As Final to cancel the mark as final designation. After the user selects that command, the workbook is no longer read-only or view-only. Therefore, this method doesn’t guarantee that others will not change the workbook.

Inspecting a workbook

If you plan to distribute a workbook to others, you may want to have Excel check the file for hidden data and personal information. This tool can locate hidden information about you, your organization, or about the workbook that you may not want to share with others.

To do so, choose Office Inspecting a workbook Prepare Inspecting a workbook Inspect Document. You see the dialog box shown in Figure 31.9. Click Inspect, and Excel displays the results of the inspection and gives you the opportunity to remove the items it finds.

The Document Inspector dialog box identifies hidden and personal information in a workbook.

Figure 31.9. The Document Inspector dialog box identifies hidden and personal information in a workbook.

New Feature

The Document Inspector is a new feature in Excel 2007.

Caution

If Excel identifies items in the Document Inspector, it doesn’t necessarily mean that they should be removed. In other words, you should not blindly use the Remove All buttons to remove the items that Excel locates. For example, you may have a hidden sheet that serves a critical purpose. Excel will identify that hidden sheet and make it very easy for you to delete it. To be on the safe side, always make a backup copy of your workbook before running the Document Inspector.

Using a digital signature

Excel lets you add a digital signature to a workbook. Using a digital signature is somewhat analogous to signing a paper document. A digital signature helps to assure the authenticity of the workbook and also ensures that the content hasn’t been modified since it was signed.

After you sign a workbook, the signature is valid until you make changes and resave the file.

Getting a digital ID

In order to digitally sign a workbook, you must obtain a certificate from a certified authority who is able to verify the authenticity of your signature. Prices vary, depending on the certificate granting company.

Another option is to create your own digital ID, but others will not be able to verify the authenticity. Creating your own digital ID is useful if you want to ensure that no one has tampered with one of your signed workbooks.

Signing a workbook

Excel 2007 supports two types of digital signatures: a visible signature and an invisible signature.

To add a visible digital signature, choose Insert Signing a workbook Text Signing a workbook Signature Line Signing a workbook Microsoft Office Signature Line. Excel displays its Signature Setup dialog box, and you’re prompted for the information for the signature. After you add the signature box, double-click it to display the Sign dialog box, where you actually sign the document either by typing your name or uploading a scanned image of your signature.

Figure 31.10 shows a document with a visible digital signature.

This document has a digital signature.

Figure 31.10. This document has a digital signature.

To add an invisible digital signature, choose Office This document has a digital signature. Prepare This document has a digital signature. Add a Digital Signature.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset