Protecting Your Privacy


Office documents may not look like privacy nightmares, but many of them are actually riddled with data that can unwittingly disclose information about you, other people who have used the document, file locations, email addresses, and much more. This type of information is known as metadata, and if you're even slightly concerned about maintaining your privacy, you should take steps to minimize or remove metadata.

That's not to say that metadata is always evil. Much metadata is generated by the collaboration techniques you learned about in Chapter 7, "Working as a Team: Collaborating with Other Users" and Chapter 9, "Collaborating with a Tablet PC and OneNote." Tracked changes, comments, and annotations all generate metadata about the reviewers, which is truly useful in a collaborative environment. However, after the document is finished, all that metadata is no longer required; and if you'll be publishing the document, the metadata is a serious privacy concern, as well.

The next three sections show you how to eliminate metadata as much as possible in your Office documents.

Setting Document Privacy Options

Word, Excel, PowerPoint, and Publisher all contain an option that automatically eliminates much metadataincluding the document author, track changes authors, and comment authorseach time you save a document. Follow these steps to activate this option:

1.

Select Tools, Options to display the Options dialog box.

2.

Select the Security tab.

3.

Activate the Remove Personal Information from File Properties on Save check box.

4.

Click OK.

Note that Word's Security tab also contains the following privacy options:

  • Warn Before Printing, Saving or Sending a File that Contains Tracked Changes or Comments When you activate this option, any attempt to print, save, or email a document that has tracked changes or comments results in a query dialog box similar to the one shown in Figure 14.13. Click OK to continue with the operation; click Cancel to end the operation.

    Figure 14.13. You can set up Word to warn you when you attempt to print, save, or email a document that contains tracked changes or comments.


  • Store Random Number to Improve Merge Accuracy When this option is activated, Word stamps a document with a unique random number. When you attempt to merge two versions of a document, Word uses this random number to enhance the merge process. However, a savvy user could theoretically use the random number to prove that two documents are related (that is, one is an earlier version of the other). If you removed sensitive data from one version, but the other version still contains this data, the random number tells the snoop that's he's found the scrubbed data. Although this isn't a serious privacy threat, it's probably still a good idea to deactivate this option.

Preventing Outlook from Adding Properties

Even if you scrub your Word document clean, you could still be foiled by Outlook if you send the document as an attachment, because Outlook automatically adds properties that identify the sender, among other privacy-busting items. To prevent this, select Tools, Options, select the Preferences tab, click E-mail Options, click Advanced E-mail Options, and then deactivate the Add Properties to Attachments to Enable Reply with Changes check box.


  • Make Hidden Markup Visible When Opening or Saving When this option is activated, Word displays markup (such as tracked changes, comments, and ink annotations) when you open a document. To leave markup hidden after opening a document, deactivate this option.

Using the Remove Hidden Data Tool

Word, Excel, and PowerPoint documents actually have a lot more privacy problems than simply the personal information of the document authors and editors. Document versions, routing slips, Excel scenario comments, and even recorded VBA macro descriptions (which include your name) are all potential privacy problems.

All these items can be scrubbed from a document by hand, but Microsoft has given us an easier method: an Office add-in called the Remove Hidden Data tool, which you can download here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=144e54ed-d43e-42ca-bc7b-5446d34e5360

This add-in enhances privacy by automating the removal of the following document data:

  • Your username

  • Your personal summary information

  • The names of previous authors and editors

  • Revision marks (all revisions are accepted)

  • Reviewer comments

  • Deleted text

  • Document versions

  • Routing slips

  • Email headers

  • Descriptions added as comments to recorded VBA macros

  • In Excel, comments attached to scenarios

  • In Office 97 documents only, unique identifiers (which included information about the computer and the person who registered the software)

Remove Hidden Data Tool Issues

Before running the Remove Hidden Data add-in, you might want to take a look at the known issues (none of which are terribly serious) for this program, as described here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;834636


After you install the Remove Hidden Data tool, follow these steps to use it on a document:

1.

Open the document you want to work with.

2.

Select File, Remove Hidden Data. The Remove Hidden Data dialog box appears, as shown in Figure 14.14.

Figure 14.14. Use the Remove Hidden Data add-in to remove private data from a document.


3.

Enter the path and filename of the new version of the document that will have the private data removed, and then click Next. The add-in removes the private data.

4.

Click Finish. The add-in displays a report of the data it removed.

Removing Other Private Data

The Remove Hidden Data add-in does a good job of removing the major sources of private data, but it doesn't get them all. The next few sections take you through a few other potential sources of privacy breaches.

Removing Hidden Text

If you use hidden text in a Word document to store sensitive information, you need to be sure to delete that text before publishing the document. One way to do this is to display hidden text (select Tools, Options, select the View tab, and activate the Hidden Text check box) and then use the Find feature to locate text where the font is formatted as hidden. You could also use a VBA macro like the one shown in Listing 14.1.

This Chapter's Examples

You'll find the Word, Excel, and PowerPoint files used as examples in this chapter on my website at www.mcfedries.com/OfficeGurus.


Listing 14.1. A Procedure That Finds the Hidden Text in the Active Document and Prompts to Delete It
 Sub RemoveHiddenText()     Dim nResult As Integer     Dim nDeletes As Integer     Dim nRemaining As Integer     '     ' Start from the top of the document     '     Selection.HomeKey Unit:=wdStory     '     ' Display hidden text     '     ActiveDocument.ActiveWindow.View.ShowHiddenText = True     '     ' Find and display all instances of hidden text     '     nDeletes = 0     nRemaining = 0     Do While True         '         ' Find the next instance         '         With Selection.Find             .ClearFormatting             .Text = ""             .Replacement.Text = ""             .Forward = True             .Wrap = wdFindStop             .Format = True             .Font.Hidden = True             .Execute             '             ' Was it found?             '             If .Found Then                 '                 ' If so, ask the user if they want to delete it                 '                 nResult = MsgBox("The following hidden text was found " & _                                  "in the document:" & vbCrLf & vbCrLf & _                                  Selection.Text & vbCrLf & vbCrLf & _                                  "Do you want to delete it?", _                                  vbYesNo, "Found Hidden Text")                 '                 ' If Yes, delete it                 '                 If nResult = vbYes Then                     Selection.Range.Delete                     nDeletes = nDeletes + 1                 Else                     nRemaining = nRemaining + 1                 End If             Else                 '                 ' If no more hidden text was found,                 ' we're done, so exit the loop                 '                 Exit Do             End If         End With     Loop     MsgBox "Instances of hidden text deleted: " & nDeletes & vbCrLf & _            "Instances of hidden text remaining: " & nRemaining,,"Done!" End Sub 

This procedure sets the ShowHiddenText property to true to display the active document's hidden text. A Do loop then calls the Find method to look for the next instance of hidden text (where the Font.Hidden property is TRue). If an instance is found (the Find object's Found property is TRue), a message is displayed, like the example shown in Figure 14.15. Click Yes to delete the hidden text (and increment the nDeletes counter) or click No to leave it (and increment the nRemaining counter). When all the instances of hidden text have been found, the code exits the Do loop and another message box shows the number of instances of hidden text deleted and still remaining in the document.

Figure 14.15. When the RemoveHiddenText macro finds an instance of hidden text in the active document, it displays a message box like the one shown here.


Removing Hyperlinks

Hyperlinks in a document can cause privacy problems because they may point to local files, network shares, or web pages that contain sensitive data. Just in case, use the VBA procedure in Listing 14.2 to examine the hyperlinks and handle them accordingly (delete the entire hyperlink, including the display text; delete just the link; or do nothing).

This Chapter's Examples

Listing 14.2 applies to a Word document, but you can also remove hyperlinks from Excel and PowerPoint documents using a similar technique. See my website for the Excel and PowerPoint versions of Listing 14.2.


Listing 14.2. A Procedure That Finds the Hyperlinks in the Active Document and Prompts to Delete the Entire Hyperlink or Just the Link
 Sub RemoveHyperlinks()     Dim nResult As Integer     Dim nHDeletes As Integer     Dim nLDeletes As Integer     Dim nRemaining As Integer     Dim r As Range     Dim hl As Hyperlink     '     ' Initialize counters     '     nHDeletes = 0     nLDeletes = 0     nRemaining = 0     '     ' Run through all the hyperlinks in the document     '     For Each r In ActiveDocument.StoryRanges         For Each hl In r.Hyperlinks             nResult = MsgBox("The following hyperlink was found in " & _                        "the document:" & vbCrLf & vbCrLf & _                        "Text: " & hl.TextToDisplay & vbCrLf & _                        "Link: " & hl.Address & vbCrLf & vbCrLf & _                        "Click Yes to delete entire hyperlink" & vbCrLf & _                        "Click No to delete just the link" & vbCrLf & _                        "Click Cancel to leave the hyperlink", _                        vbYesNoCancel, "Found Hyperlink")             '             ' Handle the result             '             Select Case nResult                 Case vbYes                     '                     ' Delete the entire hyperlink                     '                     hl.Range.Delete                     nHDeletes = nHDeletes + 1                 Case vbNo                     '                     ' Delete just the link                     '                     hl.Delete                     nLDeletes = nLDeletes + 1                 Case vbCancel                     '                     ' Leave the hyperlink as is                     '                     nRemaining = nRemaining + 1             End Select         Next     Next     MsgBox "Hyperlinks deleted: " & nHDeletes & vbCrLf & _            "Links deleted: " & nLDeletes & vbCrLf & _            "Hyperlinks remaining: " & nRemaining, , "Done!" End Sub 

The RemoveHyperlinks procedure runs through all the hyperlinks in the active document. For each one, it displays a message that lists the hyperlink text and address and asks the user what to do with the hyperlink: delete it, delete just the link, or ignore it (refer to Figure 14.15). A Select Case structure handles the three possibilities and increments the corresponding counters. When all the hyperlinks have been handled, a message box displays the final counter totals, as shown in Figure 14.16.

Figure 14.16. When the RemoveHyperlinks procedure finds a hyperlink, it displays a message box similar to the one shown here.


Remove Document Variables

As you learned in Chapter 11, "Maximizing Office with VBA Macros," you can use program variables to store data for later use in a procedure. One common problem that VBA programmers face is how to store data between macro sessions. That is, if I run a macro today, how can I preserve the results for when I run the macro again tomorrow?

See "Understanding Program Variables," p. 372



You can use a number of methods to overcome this programfor example, by storing the data in the Windows Registrybut one solution that Word VBA programmers often turn to is the document variable. This is a storage location similar to a program variable, except that instead of being stored in memory, the variable is stored in a Word document. The variable isn't visible to the user, but any VBA programmer can easily write a short procedure to enumerate a document's variables and their values.

If you or someone else has used document variables to store private or sensitive data, you should clear the document variables before making the document available for public consumption. Listing 14.3 shows a procedure that removes the document variables from a Word document. Click Yes to delete the document variable (and increment the nDeletes counter) or No to leave it (and increment the nRemaining counter). When all the instances of document variables have been handled, the code displays another message box showing the number of variables deleted and still remaining in the document.

Listing 14.3. A Procedure That Finds the Variables in a Document and Prompts to Delete Them
 Sub RemoveDocumentVariables()     Dim nresult As Integer     Dim nDeletes As Integer     Dim nRemaining As Integer     Dim v As Variable     '     ' Find and display all instances of document variables     '     nDeletes = 0     nRemaining = 0     For Each v In ActiveDocument.Variables         '         ' In each case, ask the user if they want to delete it         '         nresult = MsgBox("The following variable was found " & _                          "in the document:" & vbCrLf & vbCrLf & _                          "Name: " & v.Name & vbCrLf & _                          "Value: " & v.Value & vbCrLf & vbCrLf & _                          "Do you want to delete it?", _                          vbYesNo, "Found Document Variable")         '         ' If Yes, delete it         '         If nresult = vbYes Then             v.Delete             nDeletes = nDeletes + 1         Else             nRemaining = nRemaining + 1         End If     Next 'v     MsgBox "Document variables deleted: " & nDeletes & vbCrLf & _            "Document variables remaining: " & nRemaining, , "Done!" End Sub 

The RemoveDocumentVariables procedure runs through the collection of Variable objects in the active document. In each case, the procedure displays a message box showing the variable name and value, as shown in Figure 14.17.

Figure 14.17. When the RemoveDocumentVariables procedure finds a document variable, it displays a message box similar to the one shown here.


Removing Field Codes with Links

Another potential Word privacy breach is a field in which the code contains a link. For example, the IncludePicture field inserts a picture into a document by linking to an image file on a local hard disk, network share, or remote server. Similarly, the Link field inserts an object based on a pathname or URL. You should examine your document for linked field codes before publishing it.

For the details on using fields in Word, see "Using Fields to Insert Dynamic Data" p. 21



If you have only a few fields, one way to prevent privacy problems is to display all the field codes (select Tools, Options, display the View tab, activate the Field Codes check box, and select Always in the list box). For each field that contains a link, click the field and then press Ctrl+Shift+F9 to unlink the field.

If you have a number of fields, however, use the procedure in Listing 14.4 to run through all the fields automatically.

Listing 14.4. A Procedure That Finds the Fields in a Document and Prompts to Delete Them
 Sub RemoveLinkedFields()     Dim nresult As Integer     Dim nDeletes As Integer     Dim nUnlinks As Integer     Dim nRemaining As Integer     Dim f As Field     '     ' Find and display all instances of document variables     '     nDeletes = 0     nUnlinks = 0     nRemaining = 0     For Each f In ActiveDocument.Fields         '         ' Check for a linked field         '         If f.Type = wdFieldIncludePicture Or _            f.Type = wdFieldIncludeText Or _            f.Type = wdFieldLink Then             '             ' In each case, ask the user if they want to delete it             '             nresult = MsgBox("The following linked field was found " & _                          "in the document:" & vbCrLf & vbCrLf & _                          "Code: " & f.Code & vbCrLf & vbCrLf & _                          "Click Yes to delete the field" & vbCrLf & _                          "Click No to unlink the field" & vbCrLf & _                          "Click Cancel to leave the field", _                          vbYesNoCancel, "Found Linked Field")             '             ' Handle the result             '             Select Case nresult                 Case vbYes                     '                     ' Delete the field                     '                     f.Delete                     nDeletes = nDeletes + 1                 Case vbNo                     '                     ' Unlink the field                     '                     f.Unlink                     nUnlinks = nUnlinks + 1                 Case vbCancel                     '                     ' Leave the field as is                     '                     nRemaining = nRemaining + 1             End Select         End If     Next 'f     MsgBox "Fields deleted: " & nDeletes & vbCrLf & _            "Fields unlinked: " & nUnlinks & vbCrLf & _            "Fields remaining: " & nRemaining, , "Done!" End Sub 

The RemoveLinkedFields procedure runs through all the fields in the active document. For each one, it tests for a linked field type; if it finds one, it displays a message that lists the field code and asks the user what to do with the field: delete it, unlink it, or ignore it (see Figure 14.18). A Select Case structure handles the three possibilities and increments the corresponding counters. When all the fields have been handled, a message box displays the final counter totals.

Figure 14.18. When the RemoveLinkedFields procedure finds a field, it displays a message box similar to the one shown here.




Tricks of the Microsoft Office Gurus
Tricks of the Microsoft Office Gurus
ISBN: 0789733692
EAN: 2147483647
Year: 2003
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net