Calling for Backup (Part 1)

UPDATE: I have adjusted the batch file slightly so that in error messages it provides the name of the file being backed up, in case users want to use it to back up something other than the normal template.

Word’s Normal.dotm template is the repository for the default styles that determine the appearance of your Word documents. It is also the default location for storing your macros and keyboard shortcuts. Occasionally this file becomes corrupted, and then Word happily replaces the damaged file with a fresh new copy so that it can continue to chug along. But this means that any customizations you have made will be lost.

It isn’t clear why Word does not provide an option to automatically backup and restore this file, as it would save a lot of trouble. Of course, in a perfect world, everyone backs up their computer regularly, so this isn’t a problem. But in case you are one of the 20% of people who don’t—or if you want to make a copy for moving to another computer or for some other reason—manually making a backup copy is a fairly simple process:

  1. Verify that Word is closed (to make sure any template changes are saved).
  2. Navigate to the template folder (C:\Users\[user name]\AppData\Roaming\Microsoft\Templates\) and find Normal.dotm, the Normal template. This is in a hidden folder, so you can either paste the path above into File Explorer and substitute the appropriate user name or you can reveal hidden items by clicking on the File Explorer’s View button and toggling “Hidden items” in the Show/hide portion of the ribbon.
  3. Make a copy of the Normal template, giving it an appropriate name, such as Normal-backup.dotm. It is a good idea to put this backup file (or a copy of it) in another location as insurance against something catastrophic like a hard disk crash.

When your Normal template is eventually corrupted and replaced by Word, substituting your backed-up version is similarly simple:

  1. Verify that Word is closed (as the Normal template cannot be renamed or deleted while it is in use).
  2. Navigate to the template folder.
  3. Rename the new Normal.dotm template Word generated. Or delete it, as Word will create a new copy if one is not found.
  4. Make a copy of your backup file and rename it Normal.dotm.
  5. Open Word and verify that everything is working the same as before the corruption.

It is advisable to back up the Normal template whenever you add a macro, change a keyboard shortcut, or adjust a built-in style (at least if you are concerned about losing these changes). This can become a bit tiresome if done often, and it is easy to get behind if you aren’t having it handled for you automatically.

Batch Files

To simplify the backup process, I’ve created a batch file that completes the steps for making a backup copy. (The batch file is designed to work with Office 365 running in Windows 10, but is adaptable to other versions of Office and Windows if it doesn’t work out of the box.)

A batch file is a program similar to a Word macro, but it runs in Windows and handles operating system functions like copying and deleting files. The batch file in question checks to see that the Normal.dotm template for the logged-in user is where it should be, verifies that the location the backup file will go exists, and makes a renamed copy of the template,  overwriting any older backup that has the same name. While it is only completing a few basic actions, running it is a lot handier than doing the steps manually.

To create the batch file, copy the code provided below, paste it into Word’s Notepad program, and save it as BackupNormalTemplate.bat (or another file name ending with “.bat”).

Asking for Permission

Antivirus software is suspicious of programs that make file changes and will try to get in the way of this batch file. It is possible that you will get an error message—for example, a message that the Normal template cannot be found, even when it is obviously where it should be—if you try to run the batch file at this point (figure 1). The possible remedies vary depending on how your computer is set up and where the batch file is located, but I have found that adding an exclusion for the batch file solves this problem when it occurs.

Figure 1. The error message provided when the Normal template is not found or accessible.

Running the Batch File

To run the batch file, simply double-click on its icon. You will either get a message that it was successful or that it ran into some problem. If you want to verify that it worked, navigate to the template folder and check to see that a backup file is there and has the same date and time as the Normal template.

By default I’ve set the batch file up to save the backup in Word’s template directory, to simplify doing a restoration. But by changing the value of “targetpath” in the batch file you can have it save it to another folder or drive (be sure the new path ends with a backslash: \ ). If your path contains spaces, the targetpath variable must be in quotation marks. You can also change the name of the backup by adjusting the “targetfile” variable.

In Part 2 of this post, I’ll provide instructions on having Window’s Task Manager program periodically run the batch file for you.

The Code

@Echo Off
 set sourcepath=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Templates\
 set sourcefile=Normal.dotm
 set targetpath=C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Templates\
 set targetfile=Normal_backup.dotm
 if EXIST %sourcepath% (
     cd %sourcepath%
     if EXIST %sourcefile% (
         if EXIST %targetpath% (
             copy /Y %sourcepath%%sourcefile% %targetpath%%targetfile%
             if errorlevel 1 (
                     echo Copying %sourcefile% failed due to an error.
                     echo Try re-running the batch file later.
             ) else (
                 echo Backup of %sourcefile% was successful!
         ) else (
             echo The target destination for backing up %sourcefile% was not found.
             echo Please verify the path is correct and then rerun the batch file.
     ) else (
         echo %sourcefile% was not found and has not been backed up.
         echo Please verify the files exists and you have permission to copy it,
         echo and then rerun the batch file.
 ) else ( 
     echo The folder containing %sourcefile% was not found,
     echo so that file cannot be backed up.
     echo Please verify the path is correct and then rerun the batch file.

A Faster Path to Keyboard Shortcuts

I was recently adding some keyboard shortcuts in Word and noticed that the ALT + CTRL + NUM + shortcut (“Num +” is the addition key on the numeric keypad) was assigned to a command I hadn’t heard of: ToolsCustomizeKeyboardShortcuts. Apparently this shortcut is the only way to run this command, which is unfortunate because it can save you a lot of time when you are modifying shortcuts.

Using the Command

When you press ALT + CTRL + NUM + your mouse arrow will change to the looped square symbol: ⌘. While this new pointer is visible, you can get information on keyboard shortcuts in two ways: by selecting a command or by pressing a keyboard shortcut combination.

Setting a Shortcut for a Command

If you use the looped square cursor to select a command in the Ribbon, Quick Access Toolbar, or Status Bar, Word will pop up the Customize Keyboard dialogue box. This will display the current shortcut(s) assigned to the selected command and allow you to make adjustments.

You can also view shortcuts for commands triggered from dialogue boxes. For example, if you open the Styles dialogue box (CTRL + ALT + SHIFT + S), you can use the looped square icon to add a shortcut for the Style Inspector: select the icon showing an A with a magnifying glass. This is a handy command that doesn’t have a predefined shortcut and is not easily navigated to.

You may recall seeing Word display the shortcut assigned to a ribbon command when the cursor hovers over it (for example, when you hover over the Bold icon). However, Word doesn’t always display shortcuts when you hover (as when you hover over the New Comment icon). And if more than one shortcut is assigned to a command, when hovering does work it will only show one of the shortcuts. So this command is a much more accurate way to identify shortcuts.

Checking a Combination of Keys

If you press a keyboard shortcut while the looped square icon is visible, Word will also pop up the Customize Keyboard dialogue box, this time displaying the command assigned to that shortcut. This is very handy for determining if a particular shortcut is currently in use.

There is a downside to this command, however: it will not work for keyboard shortcuts that consist of the ALT key and another single key. If you run the command and then press this kind of shortcut combination, Word will display the KeyTips for the current ribbon menu, just as if you were pressing the ALT key by itself.

Other Tips

When the mouse pointer appears as a looped square symbol (⌘) you can press the Esc key to exit this command and be returned to a regular mouse arrow.

To use this command on a laptop that doesn’t have a numeric pad, you can manually assign it to another shortcut:

  • Burrow down to the Customize Keyboard dialogue box: File > Options > Customize Ribbon > Keyboard shortcuts: Customize…
  • In the Categories window on the left, scroll all the way to the bottom and select the All Commands category.
  • In the Commands window on the right, scroll down to ToolsCustomizeKeyboardShortcuts
  • In the Press New Shortcut Key field press the desired key combination  (I recommend ALT + K) and select the Assign button, then close all of the dialogue boxes.

This tool does not appear to work when selecting macros or third-party commands such as those for PerfectIt via a menu. It will, however, indicate which macro is assigned to a given shortcut.

Swapping User Names

I have a client who wants the user name that appears in my Microsoft Word comments and revisions to match the level of editing being done. For example, in a document I am copyediting my user name should read “copyeditor” and in a document I am proofreading it should read “proofreader.” Manually changing the user name when I switch between documents doesn’t take a lot of time, but it is a bit of a pain to do repeatedly. The manual change also creates the opportunity for misspellings and inconsistencies to creep in.

Figure 1: Each time the macro is run, Word’s user name is set to the next name in the series

To automate changing the user name, I created a macro that steps through a series of names and assigns the next name in the series each time the macro is run. (It also changes the user initials.) After the last name has been assigned, the macro starts again with the first name in the series. Editing the user names in the series involves a little adjustment of the macro’s code but is not too complicated.

Using the Macro

The version of the macro presented below has four user-name-and-initial options. Each time the macro is run, the user name will be updated to the next name in the series and this new user name will appear in the Word status bar (in the lower left corner of the screen) until a key or mouse button is pressed. If you would also like to have a pop-up dialogue box display the updated name, delete the apostrophe in the second to last line, before “MsgBox.”

Manually entering a user name in Word will not affect the way the macro works. If a user name that is not part of the series has been manually entered, the first user name in the series (in this case, “Dev Editor”) will be substituted when the macro is run. While the macro sets user initials, it doesn’t check to see if they have been manually edited. Any manual edits of user initials will be overwritten when the macro is run.

I assign this macro to the keyboard shortcut Alt + u to make it easier to run. If you would like to have this macro automatically add that shortcut, delete the apostrophe in the second line, before “KeyBindings.” You will have to run the macro once manually before the shortcut will be set.

Customizing the User Names

You will likely want to edit the series of user names. This involves a little adjustment of the “case” commands in the macro but is not too complicated of a process. The steps are as follows.

Determine how long of a series you want. To remove a name from the series, delete one set of three lines: a line beginning with “Case” and the following two lines that begin “NewName” and “NewInitials.” Don’t delete the final “Case Else” statement, though. To add a name to the series, duplicate the three lines mentioned above and place them before the final “Case Else” section.

Adjust the user names and initials. On the lines beginning  with “NewName” and “NewInitials” change the text in quotes to the desired user name and initials. Then set the name in the first line that starts with “Case” to match the “NewName” field in the “Case Else” section. Finally, change the name in each of the other “Case” lines to match the “NewName” field in the section that precedes it.

 The Code

Sub Swap_User_Names()
     'KeyBindings.add wdKeyCategoryMacro, "Swap_User_Names", BuildKeyCode(wdKeyAlt, wdKeyU)
     OldName = Application.UserName
     Select Case OldName
         Case "Dev Editor"
             NewName = "Copyeditor"
             NewInitials = "CE"
         Case "Copyeditor" 
             NewName = "Proofreader"
             NewInitials = "PR"
         Case "Proofreader" 
             NewName = "Cold Reader"
             NewInitials = "CR"
         Case Else
             NewName = "Dev Editor"
             NewInitials = "DE"
     End Select
     Application.UserName = NewName
     Application.UserInitials = NewInitials
     StatusBar = "User Name is now " & NewName
     'MsgBox ("User Name is now " & NewName)
 End Sub

Tools for Style Setters

Word users commonly adjust the formatting of text in four ways:

  • Assigning a paragraph style such as No Spacing or Block Text
  • Assigning a character style such as Strong or Emphasis
  • Applying manual paragraph formatting such as indenting and line spacing
  • Applying manual character formatting such as italics or underlining

Users can easily make all of these format adjustments using the ribbon or shortcut keys. However, figuring out after the fact which styles have been applied or where a particular bit of formatting comes from can take some work. The ribbon can indicate some of the formatting that has been applied, but not all of it and not consistently. For example, the Styles section of the ribbon and the Styles pane indicate at most one applied style. If both a paragraph style and a character style have been applied, the field will only indicate the character style. The ribbon also doesn’t disclose whether the indicated style has been overridden by manual adjustments.

A solution to this problem is available via the Style Inspector pane the Reveal Formatting pane. Unfortunately, Microsoft has hidden the former—neither a button on the ribbon nor a built-in shortcut is provided. And access to the latter is only slightly better.

Style Inspector

Figure 1: The Style Inspector Pane

The Style Inspector pane (Figure 1) provides a summary of the formatting applied at the current cursor location, indicating the names of assigned paragraph and character styles (in white fields) and manually applied paragraph and character formatting (in gray fields). Beside each field is a button that allows the user to reset that particular type of formatting. And included at the bottom of the pane are buttons to launch the Reveal Formatting pane, create a new style, and clear all formatting at one time.

While the interface clearly lays things out for the user, more is available if you poke around. If you want to see what formatting the styles provide, you need to hover your cursor over the respective fields. (Or you can bring up the Reveal Formatting pane). The paragraph and character style fields are also drop-down menus that provide access to additional commands. Some of these duplicate the functions of other easier-to-access buttons, though.

Another not-immediately-obvious quirk of this pane is that it provides clearer information if you have placed your cursor within the text you want to analyze rather than selected the text. If you select text that contains more than one paragraph style, the paragraph formatting field will appear empty; the same happens if your selection contains two character styles. But seeing a blank field at least indicates a problem. If, however, you select text containing two or more manual character format changes or paragraph format changes, the field will identify only the first one in the selection. However, the buttons will still remove formatting, whether or not the fields identify it.

Given the usefulness of this pane, why doesn’t it have a predefined shortcut or button to provide access to it? The easiest built-in path is to use the shortcut CTRL + ALT + SHIFT + S to bring up the Styles pane and then press the Style Inspector button (the middle button in the lower left corner of the pane). If you find yourself using Style Inspector frequently, you can create a keyboard shortcut to the “FormattingPaneCurrent” command. Or you can create a quick access toolbar button or ribbon button for the “Style Inspector” command. (Why two different names? Apparently to make things even more complicated.)

NOTE: Microsoft Office Word 2007 Essential Reference for Power Users by Matthew Strawbridge indicates two additional lurking issues. The first is that the manual paragraph styling field does not indicate all types of paragraph formatting. Unfortunately Strawbridge doesn’t state which ones. The second is that the text-level field will not indicate that any formatting has been applied if you place the cursor at either end of a stretch of formatted text.

Reveal Formatting

Figure 2: The Reveal Formatting Pane

The Reveal Formatting pane (Figure 2) provides a detailed list of formatting at the font, paragraph, and section levels and acts as a nice supplement to the Style Inspector. The “Distinguish style source” toggle, located at the bottom of the pane, adds headings to the list to clarify which formats have been manually applied and which are applied via a style. This is particularly useful because it indicates when a paragraph style includes character-level formatting. The “selected text” field is also a drop-down menu providing access to a few additional commands.

Another useful feature is the “Compare to another selection” option that indicates how the format of two selections differ. This tool is toggled on and off using the control near the top of the pane.

Unlike Style Inspector, Reveal Formatting does have a predefined shortcut key: Shift + F1. Unfortunately, it does not include a button to launch the Style Inspector. (This is another reason to set up a Style Inspector shortcut).

As with all Word features, Reveal Formatting isn’t perfect:

  • The “Show all formatting marks” toggle at the bottom on the page simply duplicates the “show/hide ¶” toggle on the ribbon.
  • This pane doesn’t provide any way to adjust styles, though there is a Clear Formatting option under the Selected Text drop-down menu.
  • If the selected text contains more than one character or paragraph style, the field only identifies the first style. Multiple applications of manually applied styling also causes this misreporting.
  • The drop-down menu commands “Apply formatting of surrounding text” and “Clear formatting” really only work as expected when applied to selections.

Who’s Afraid of “Bad, Big Wolf”? (Part 1)

While recently reading Mary Norris’s Between You & Me: Confessions of A Comma Queen, I was overjoyed to see that she discusses comma use related to adjacent adjectives, which seems to be an underdiscussed topic. The rules of thumb provided in popular style and usage guides work well in a lot of cases, but the basis for these rules isn’t ever explained, and I seem to be forever coming across exceptions. For example, Garner’s Modern American Usage states:

When two adjectives modifying the same noun are related in sense, they should be separated by a comma (or else and). So we say a big, sprawling house and a poignant, uplifting film. But when the consecutive adjectives are unrelated, there shouldn’t be a comma—hence a big white house and a poignant foreign film. (19)

This makes sense as long as you don’t need clarification regarding what related in sense means. A search of the Corpus of Historical American English identifies thirteen published uses of big, sprawling and seven uses of big sprawling, so there may be some disagreement about how related the terms are. Big white does somewhat better: it appears 501 times in the Corpus while big, white only appears 58 times.

Adjective Categories

Although none of the major style guides provide a definition of related in sense, linguists long ago developed a list—or, more accurately, different versions of a list—that does just this. The following list (from Adjective Order in English: A Semantic Account with Cross-linguistic Applications by Enrica Rosato) identifies eight classes of adjective. To Rosato’s eight classes I have added a ninth category (attributive noun/qualifying adjective) that some other sources mention as important to consider.


Category Example
1. General opinion: Adjectives that can apply to any noun ugly
2. Specific opinion: Adjectives to describe particular kinds of noun derelict
3. Size large
4. Shape rectangular
5. Age fifty-year-old
6. Color black
7. Origin (nationality) Malaysian
8. Material steel
9. Attributive noun/qualifying adjective oil
    Noun being described tanker


This list provides a good starting point for determining the relationships between adjectives. In Garner’s example of a big white house, big falls under the category Size and white falls under Color. Since these adjectives aren’t in the same category and are therefore unrelated, no comma would be needed. In the case of a big, sprawling house one could argue that sprawling is not necessarily related to size: Merriam-Webster’s Collegiate Dictionary defines it as to spread or develop irregularly or without restraint, which suggests that it would fall into the Shape category. Based on this guidance, the adjectives again fall into two categories, and a comma would not be required.

Adjective Order

The list also indicates the order in which adjectives typically appear. That a regular order exists helps explain a second rule of thumb for comma use, which appears in Morson’s English Guide for Court Reporters as “If reversing the order of the adjectives does not affect the naturalness of the sentence, use the comma.” That is, poignant, uplifting film sounds as natural as uplifting, poignant film, so a comma should be used. But white big house sound decidedly awkward, so a comma would be out of place.

The Chicago Manual of Style phrases the rule slightly differently, stating that coordinate adjectives (those that should be separated by commas) “can also usually be reversed in order and still make sense.” Phrased in this way, this rule seems to be of limited usefulness: both black ugly tanker and ugly black tanker are perfectly understandable, if not both perfectly natural sounding. Chicago’s rule seems best suited for resolving relatively uncommon situations, such as where an attributive noun could be misidentified as an adjective: for example, ornery fur trapper makes sense while fur ornery trapper doesn’t.

With naturalness, as with related in sense, we have rely on an intuitive sense of what the undefined term means. Mary Norris alludes to this problem in Between You & Me, in a passage in which she also applies the rule “if you can substitute ‘and’ for the comma it belongs there”:

Then it happened again: “She smiled that stunning, wide smile.” The phrase “stunning and wide” doesn’t make it for me, and neither does “wide and stunning” (although I would have read right over “wide, stunning smile”). (106)

Applying the naturalness rule also requires a familiarity with the adjectives being used: venerable, lofty redwoods probably sounds more natural to most people than does old, tall trees. Using the adjective list (as well as a good dictionary) removes the necessity of relying on an innate sense of naturalness for decision making.

The problem with all of this is that there are idioms that don’t adhere to this logic (big bad wolf is a common example) as well as author preferences (as Mary Norris discovered). So in part 2, I will try to address a more important question: Does any of this really matter?

Counting Words by Chapter

When starting a new project I have found it very useful to develop a chapter-by-chapter word count for the manuscript: this lets me make sure my pace isn’t too fast or too slow and helps me develop a schedule for how many chapters per day I should cover. Developing this count by hand isn’t particularly efficient, so I recently decided to hunt down a macro to handle this work for me.

After a bit of online searching I found a macro posted by onesecondglance that did what I wanted. However it took a long time to analyze book-length Word documents, even after extensive rewriting. To replace it I developed new a macro using code by CuberChase as a starting point.

This macro queries the user for the name of the Word style applied to chapter headings (“Heading 1” is the default) and then counts words from the start of one heading to the start of the next. It also counts any words that appear before the first heading. It then creates a new word document and inserts into it the name of each chapter followed by that chapter’s word count. A tab character is inserted between each chapter name and word count so that the contents can be easily cut and pasted into an Excel spreadsheet.

As written the macro does have a few limitations, which I may get around to addressing if they present a problem:

  • It considers anything formatted using the heading style to be a heading, including blank lines, so make sure that the style is only applied to actual headings.
  • It does not count text in footnotes, endnotes or text boxes.
  • It does not like hidden track changes in headings and has been written to display all revisions before running. Because of this it will extract both the original and revised heading text.


The Code

Sub Chapter_Word_Count()
'Based on code from:

	Dim iCount As Integer
	Dim iArrayCount As Integer
	Dim bFound As Boolean
	Dim rParagraphs As Range
	Dim lCurPos As Long
	Dim iParNum As Integer
	Dim iOffset As Integer
	Dim rBody As Range
	Dim sMyStyle As String

        With ActiveWindow.View.RevisionsFilter
            .Markup = wdRevisionsMarkupAll
            .View = wdRevisionsViewFinal
        End With

	'Initialize 100-entry array
	Dim sArray() As String
	iArrayCount = 100
	iOffset = 0
	ReDim sArray(1 To 3, 1 To iArrayCount)

	'Collect name of style type
	sMyStyle = InputBox("What is the name of the Word style used for chapter headings?", "Count Chapter Words", "Heading 1")
	Application.ScreenUpdating = False

	'Move to top of the document
	Selection.HomeKey Unit:=wdStory

	'Set search parameters and look for the first instance
	With Selection.Find
		.Text = ""
		.Replacement.Text = ""
		.Forward = True
		.Wrap = wdFindContinue
		.Format = False
		.MatchCase = False
		.MatchWholeWord = False
		.MatchKashida = False
		.MatchDiacritics = False
		.MatchAlefHamza = False
		.MatchControl = False
		.MatchByte = False
		.MatchAllWordForms = False
		.MatchSoundsLike = False
		.MatchFuzzy = False
		.MatchWildcards = True
		.Style = sMyStyle
	End With

	'If found start loop to check for entries
	'counter added to avoid endless loops
	Do While Selection.Find.Found = True And iCount < 1000
	iCount = iCount + 1
	'Add results to array 
	If Selection.Find.Found Then 

		bFound = True
		lCurPos = ActiveDocument.Bookmarks("\EndOfSel").Start
		Set rParagraphs = ActiveDocument.Range(Start:=0, End:=lCurPos) 
		iParNum = rParagraphs.Paragraphs.Count 

		'Check array size and resize if necessary 
		If ii Mod iArrayCount = 0 Then ReDim Preserve sArray(1 To 3, 1 To UBound(sArray, 1) + iArrayCount) 
		'add an initial entry if doc doesn't start with a heading 
			If iCount = 1 And iParNum > 1 Then
				sArray(2, iCount) = "[Before first heading] "
				sArray(3, iCount) = 1
				iOffset = 1
			End If

			sArray(2, iCount + iOffset) = Selection.Text
			sArray(3, iCount + iOffset) = iParNum

			'Reset the find parameters
		End If

	If bFound Then
		'Finalise the array to the actual size
		ReDim Preserve sArray(1 To 3, 1 To iCount + iOffset)

		'Calculate chapter lengths, including length of chapter heading
		For ii = LBound(sArray, 2) To UBound(sArray, 2) - 1
			'Select range of paragraphs to measure
			Set rBody = ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(CInt(sArray(3, ii))).Range.Start, _
                        End:=ActiveDocument.Paragraphs(CInt(sArray(3, ii + 1)) - 1).Range.End)
			sArray(1, ii) = rBody.ComputeStatistics(wdStatisticWords)
		Next ii
			Set rBody = ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(CInt(sArray(3, UBound(sArray, 2)))).Range.Start, _
			sArray(1, UBound(sArray, 2)) = rBody.ComputeStatistics(wdStatisticWords)

		'Output results to a new document
		Application.ScreenUpdating = True
		For ii = LBound(sArray, 2) To UBound(sArray, 2)
			Selection.Text = Left(sArray(2, ii), Len(sArray(2, ii)) - 1) & Chr(9) & sArray(1, ii) & Chr(10)
			Selection.MoveRight wdCharacter, 1
		Next ii
		'If no headings found, return alternate message
			MsgBox "This document does not use the style " & sMyStyle, vbExclamation + vbOKOnly, "Bad Style Name"
	End If
End Sub