Archive for the ‘Software’ Category

h1

Word: Macro to insert a landscape page

May 14, 2019

A client wanted an easy way for her staff to insert a landscape page into a report without messing up the headers and footers. I recorded a macro that does just that, but it relies on headers and footers being laid out using the alignment tabs, not borderless tables. Alignment tabs are much better than inserting tabs yourself as they automatically adjust if you change the page layout.

Note: If you use borderless tables for your headers and footers, this macro will still work, but you’ll have to manually turn off the Link to Previous options for the landscape page’s headers and footers and also for the following portrait page. I might see if I can tweak the macro to do that—if so, I’ll write it up as a separate blog post.

Step 1: Set up alignment tabs for the headers and footers

  1. Open a new Word document (or the template if you want to set this up in your template).
  2. Double-click in the header area to open the header. The cursor will be at the left margin.
  3. Optional: Add any text you want positioned at the left.
  4. In the Header & Footer Tools tab > Position group, click Insert Alignment Tab.
  5. By default the next position is Center. Make sure it’s selected, then click OK.
  6. Optional: Add any text you want positioned in the centre.
  7. Click Insert Alignment Tab again.
  8. Select Right then click OK.
  9. Optional: Add any text you want positioned at the right.
  10. In the Header & Footer Tools tab > Navigation group, click Go to Footer.
  11. Repeat steps 3 to 9 above for the footers.
  12. Double-click in the main body of the document to close the header/footer area.

Step 2: Install and run the macro

The macro you will use to insert a landscape section is listed below these steps.

  1. Go to the View tab >Macros group, then select View Macros from the drop-down list.
  2. In the Macro Name field, type InsertLandscape (if you have other macros listed, the one listed first will be in that field—just type over it)
  3. Click Create. This opens the Visual Basic for Applications (VBA) window, with these lines already inserted:
    Sub InsertLandscape()
    ‘ InsertLandscape macro
    End Sub
  4. Copy the macro below this set of steps.
  5. Paste it into the blank area above End Sub.
  6. Save the change and close the VBA window. (If you’re working in a template and only want this macro available to documents based on that template, then select the template name from the Macros in field.)
  7. Test the macro by running it:
    • Go to the View tab >Macros group, then select View Macros from the drop-down list.
    • Select the InsertLandscape macro.
    • Click Run.
  8. A landscape section should be inserted into your document, and the headers and footers should all align correctly for the landscape section.

Macro

' Inserts a landscape section, adjusts headers and footers
' Created by Rhonda Bracey, CyberText Consulting, May 2019
'
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.TypeParagraph
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.MoveUp Unit:=wdLine, Count:=2
If Selection.PageSetup.Orientation = wdOrientPortrait Then
Selection.PageSetup.Orientation = wdOrientLandscape
Else
Selection.PageSetup.Orientation = wdOrientPortrait
End If
ActiveWindow.ActivePane.SmallScroll Down:=-3
ActiveWindow.ActivePane.LargeScroll Down:=1

What this macro does:

  • Inserts an empty paragraph.
  • Inserts a Next Page section break.
  • Inserts two more empty paragraphs.
  • Inserts another Next Page section break.
  • Moves the cursor back up to one of the empty paragraphs between the two section breaks.
  • Changes the area between the section breaks to Landscape orientation.
h1

Word: Macro-enabled templates stripped by Dropbox?

May 2, 2019

Well, well, well! I haven’t encountered this before, but it looks as though Dropbox.com stripped the macros from two Word templates I created for a client earlier this week.

I’d emailed her the templates (dotm files) on Tuesday, and sent some follow-up notes on Wednesday. Today (Thursday) she contacted me to ask if I’d sent the templates because she hadn’t received them. I thought that maybe her email provider’s security settings were stopping them getting through, so I zipped them up and emailed her the zip file. The zip file didn’t get to her either, so I created a folder for her in my Dropbox.com account and put the individual template files there and sent her the link to the folder.

She was able to download the templates, but when she tried to run them, she got error messages about the macros. She contacted her IT people and me. I’ve just got off the phone with her IT guy—he also had trouble with the templates and had macro error messages, and when I walked him through where the macros should be, they weren’t there. I emailed him a zip file, but he didn’t get that either. I also put the zip file into the Dropbox.com folder, and he was able to get that. Once he’d extracted the files locally, he was able to open a new document based on the template successfully AND run the macros without error. He also did some quick Googling and found that Dropbox.com DOES strip macros from Word templates. But not from those files stored in zip files—yet.

What are we to do? I use Word macros to save myself and authors enormous amounts of time. This is part of my job. My clients want quick and easy ways to apply corporate formatting to imported Excel tables and the like, to add landscape pages without angst, and so on. I create or modify macro-enabled templates for my clients and need to send the revised versions to them. If email settings and now Dropbox.com are either not allowing the templates through, or are stripping the macros out of them, how are those of us who live remotely from our clients meant to do our jobs?

h1

Word: Change author/date citations to links to auto-numbered references

May 1, 2019

Warning: Long post! Lots of steps, lots of concentration required. I suggest printing it out, grabbing a cup of your favourite beverage (preferably nonalcoholic), and working through it step by step with no distractions until you are familiar with the process.

Issue

For many years, my main client used author/date citations (e.g. Smith, 2006) in their documents, with an accompanying References list that was sorted alphabetically by author (followed by date if there was more than one instance of an author, and an alphabetic designator if there was more than one year the same by the same author).  Because ‘author’ includes any authoring body, there was a problem—they cite many of their own documents, which meant you had citations such as ‘Company, 2010’, ‘Company, 2010a’, ‘Company, 2010b’ etc. If you have to refer to more than 26 documents by the same author in the same year, you run out of letters!

To help alleviate this issue and streamline their references and citations, about three years ago they changed their templates to include an auto-numbered References list, which meant the author/date method had to change to use cross-referenced numbers. It’s a far more efficient method and is easy to update if items are added to or deleted from the References list.

For new documents, it’s easy—just use the new method. But what about the older documents on the old templates that still use the author/date citation method? If the decision is made to transfer an older document to the current template, then that decision invariably includes updating the author/date citations and references to the numbered method.

Below I discuss how I do this. It’s a complex method that can take many hours (some of the references lists I deal with contain 200 or more items). It would be greatly simplified if the client used something like a networked EndNote or Zotero database, but they don’t and won’t in the foreseeable future, so that’s not an option. In the meantime, I do it manually. This process works for me—it may not work for you, or you may use a better method. Feel free to comment.

Solution

This process assumes you’re working with an existing document that uses manually entered author/date citations, and have an existing references list that holds the bibliographic details for those citations.

Unless you are required to track these changes, turn off Track Changes before you start.

Step 1: Add a Back button to your Quick Access Toolbar (one-off task)

If you don’t already have a Back button on your Quick Access Toolbar (QAT), add it. You’ll thank me later!

  1. Click the drop-down arrow at the far right of the QAT, and select More Commands.
  2. In the Choose Commands From column, select All Commands from the drop-down list.
  3. Scroll down the list to Back and select it.
  4. Click Add in the middle of the two panels to add it to the QAT. Optional: Use the up and down arrows on the right to place it where you want it to go.
  5. Click OK.

The Back button is now on your QAT. It is inactive at the moment and only becomes available once you’ve clicked a cross-reference link (e.g. to a heading from the table of contents, or to a section, table, figure, appendix, or reference list number), and gone to another place in the document. You can then click it to return to where you clicked the link.

Step 2: Create a blank auto-numbered References list (one-off task)

You’ll already have a References section in your document—in this step, you can either create a new section, or add the new auto-numbered table to the existing one. You’ll still need to keep the existing list until you’ve transferred all the bibliographic details to the new list.

  1. Optional: Add a new heading (References) to your document, and assign the Heading 1 style to it. (If you want to keep your existing References section, just add a couple of empty paragraphs above or below the current list and then follow the steps below.)
  2. Insert a multi-row, two- or three-column table in this section, and style it as you want:
    • Use two columns if you only need a column for the number and another for the bibliographic details of the reference
    • Use three columns if you also need a column for document numbers or other information
    • Apply table header row styling to the top row, and add column headings (I use Ref. No., Title, and Doc ID).
  3. Select all the cells (but not the header row cell) in the first column and apply auto numbering to them:
    • Use either the number icon on the Home tab, or another style you use for numbering
    • Make sure the numbering starts at 1.
  4. Add more rows (I typically start with 25 rows, adding more as needed).

Step 3: Find and highlight all citations (one-off task)

In this step, you’ll use the power of wildcard find and replace to find all author/date citations, replace them with themselves (i.e. make no change), add a designation for the cross-reference (in this example, (Ref. ), which has a nonbreaking space between the period and the closing parenthesis), and highlight them. The pattern you’re looking for is a year (the authors [and how the citation is written] will be different, so you can’t pattern match those, but the years are likely to start with only ’19’ or ’20’). Whether the citation is styled ‘(Smith, 2006a)’ or ‘Smith (2006b) found…’, this method will still find it.

  1. Go to the beginning of the document.
  2. Select a highlight colour you’re not using for anything else. You MUST select a highlight colour—if you don’t, then no highlight colour will be applied to the found text.
  3. Press Ctrl+h to open the Find and Replace dialog.
  4. Click More.
  5. Check the Use wildcards checkbox.
  6. In the Find field, type: (<19*>)
  7. In the Replace field, type: \1 (Ref.^s) (Note: There’s a space after 1)
  8. With your cursor still in the Replace field, click Format and select Highlight. ‘Highlight’ should be shown immediately below the Replace field.
  9. Click Find Next.
  10. If you find a citation, click Replace to highlight the date and add the partial text container for the cross-reference number (i.e. (Ref. ) ). This method finds ALL words starting 19, including measurement values, dates, etc. whether they are part of a citation or not, so NEVER click Replace All. Check every one, and keep clicking Find Next for each date you find that isn’t part of a citation, only click Replace for those that are part of a citation. Ignore the dates in the References list—they aren’t citations either.
  11. Once you’ve finished the 19xx dates, it’s time to do the 20xx dates. Go back to the top of the document. In the Find field change 19 to 20, leaving everything else the same (you should now have (<20*>) in the Find field, and the Replace field should still be \1 (Ref.^s), with ‘Highlight’ listed below it).
  12. Click Find Next.
  13. If you find a citation, click Replace to highlight the date and add the partial text container for the cross-reference number. The same rules apply as listed in step 10 above.
  14. Once you’ve finished, close the Find and Replace dialog.

You’ve now identified all the citations in the document. The next major step is the most time-consuming, so make sure you allow plenty of time for it. For a long document with many different citations, this next step could take many hours.

Step 4: Assign a cross-referenced number to each citation (repeat multiple times, once for each citation)

  1. If field shading isn’t turned on, turn it on:
    • Go to File > Options
    • Click Advanced
    • Scroll down to the Show Document Content section
    • Select Always from the Field Shading drop-down list.
  2. Go to the beginning of the document.
  3. Use your eyes to scan the text for the highlight colour you used for the citations. If you didn’t use a different colour, it may not be a citation, so check.
  4. Leave the author/date as it is for now, and put your cursor just inside the closing parenthesis, after the nonbreaking space.
  5. On the References tab > Captions group, click Cross-reference.
  6. Choose:
    • Numbered item from the Reference Type drop-down list
    • Paragraph number (no context) from the Insert Reference To drop-down list
  7. Scroll down the list of items to the References section, then select 1. immediately below it. (This is the row numbered 1 in the References list table you created earlier.)
  8. Click Insert.
  9. A cross-reference field for 1. is added to your citation—you should now have (Ref. 1). Because you turned on field shading in step 1, the number should have grey shading behind it, indicating it’s a clickable field (you’ll see this only after you remove the highlighting).
  10. Copy the original author/date citation (e.g. Smith, 2006), then Ctrl+click the cross-reference number. This takes you to the matching row in the References table.
  11. Paste the copied author/date citation into that row. You’ll add all the bibliographic details later—you don’t want to lose the original citation at this stage, so you’ll store it in the row that will later be populated with the bibliographic details for that citation. (Tip: If you only have a small list, then you could find the matching details from the old list and add them now)
  12. Click the Back button you added earlier to the QAT to return to the citation cross-reference.
  13. Copy the number you just inserted (the field) to the clipboard.
  14. Because a single citation could have been used several times in the document, you now need to search for other instances of that citation and add the cross-reference you copied in the step above:
    • Open the Find and Replace dialog (Ctrl+h)
    • Clear the Use wildcards checkbox
    • Clear the text from the Find field
    • Clear the text from the Replace field
    • Click No Formatting to clear the ‘Highlight’ wording from below the Replace field
    • In the Find field, type the original author/date citation (sometimes the author or the date may be enough)
    • Click Find Next
  15. If you find the citation used again:
    • Click out of the Find and Replace dialog
    • Paste the field (the cross-reference number) you copied at step 13 into the (Ref. ) placeholder, just before the closing parenthesis
    • Clear any remaining highlighting and delete any unwanted text and/or extra parentheses for this citation, including the author/date part—you no longer need this because you already added it to the References list back in steps 10 and 11.
    • Click back into the Find and replace dialog, and continue searching for other instances of that citation
    • For each one found, paste the field (as above) and clear the highlighting, extra text etc.
  16. Once you’re satisfied that you’ve found them all, go back to the first instance of that cross-referenced citation, delete the original author/date, any extra parentheses, and clear the highlighting.
  17. Repeat steps 3 to 16 above for the second citation, choosing 2 instead of 1 at step 7.
  18. Repeat steps 3 to 16 for every other highlighted citation, changing the number each time. Yes, this can take HOURS. Add more rows to the bottom of References list if you’re starting to run out.

Step 5: Populate the References list with the bibliographic details from the old References list (one-off task)

Once you’ve added all the citations, you’ll need to find their matching counterparts in the original References list.

  1. Go to the first row of the table.
  2. Check the author/date citation you pasted there earlier.
  3. Find the matching item in the original References list. Use the original author/date citation information to confirm you have the correct one. (Hint: Copy the original References list into a new document and show it on a second monitor, if you have one.)
  4. Copy/paste the original bibliographic details into the Title cell in the matching row of the numbered table, deleting  the original author/date citation placeholder. (If you’re not comfortable deleting the original citation just yet, leave it for now and highlight it for later deletion.)
  5. Optional: Delete any date designator (e.g. 2010b becomes 2010), and shift any document number etc. to the other column.
  6. Repeat the steps above for each row of the table that has an author/date citation.
  7. Delete any unused rows when you’ve finished.

Adding, deleting items from the new list and updating the list

Adding new references and citations

If you need to add new items to the References list table, the simplest way is to:

  1. Insert a new row at the end of the table.
  2. Add the bibliographic details.
  3. Create the cross-referenced citation to that new number.

If you want to add the item so that the cross-referenced citation is numbered sequentially in the main body of the document, in line with the other citations, it’s a bit more complex:

  1. Turn off Track Changes.
  2. Insert a new row where you want to add the new reference (e.g. you might want it to become citation number 24, so you need to add a new row after row number 23. This new row becomes 24 and the previous 24 becomes 25 etc.). The numbers in the table update automatically, but the citations in the main document don’t.
  3. Add the bibliographic details.
  4. Create the cross-reference citation to that new number.
  5. Update all the fields in the document to reflect the new number order of the other cross-referenced citations (e.g. the previous number 24 now becomes number 25, 25 becomes 26 etc.). See below for how to do this.

Deleting reference items

If you need to delete reference items from the table:

  1. Turn off Track Changes if you aren’t required to track this change.
  2. Go to the cross-referenced citation if it exists (e.g. press Ctrl+f and search for Ref. 23 [you have to search via the navigation pane as you can’t search for a field number from the Find and Replace dialog]).
  3. Confirm that this is the one to be deleted—Ctrl+click the number to go to that row in the References table.
  4. If it’s correct, click the Back button on the QAT, and delete the cross-referenced citation.
  5. Search for any further instances of this and delete them too.
  6. Return to the References table and delete the row. The numbers in the table will automatically update, but the citations in the main document won’t.
  7. Update all the fields in the document to reflect the new number order of the other cross-referenced citations (e.g. the previous number 23 now becomes number 22, 24 becomes 23 etc.). See below for how to do this.

Updating the cross-referenced citations

Whenever you change an auto-numbered table, the numbers will automatically update, but the citations that refer to them don’t until you update all the fields in the document.

Unless you are required to track these changes, turn off Track Changes before you start.

To update all the fields in your document, do one of these:

  • switch to Print Preview view, then back to Print Layout view (quickest and easiest); or
  • press Ctrl+a to select the entire document, then press the F9 key; or
  • press Ctrl+a to select the entire document, then right-click on the selection and choose Update Field.

To update a single field, place your cursor to the immediate left of the grey shading, right-click, then select Update Field.

To check for broken fields, press Ctrl+f and search for Error!. If this message is in a cross-referenced citation, it means that Word can’t find the matching number in the References list. You’ll either have to add a new row for it (and reassign the correct number to the cross-reference), or delete the cross-referenced citation.

h1

Word: Add a separate list of appendices

May 1, 2019

Many years ago, I’d added a separate list of appendices in the front matter containing the table of contents (TOC), list of figures, list of tables etc. I’d forgotten how to do it, because these days almost every document I work on incorporates the appendix headings into the main TOC. However, I needed to do this for a new client, who had appendix placeholders in the document with no page numbering (the PDF’d appendices would be inserted later, so they only needed a heading page). Adding the appendix headings to the main TOC wasn’t an option because the main TOC has page numbers and you can’t tell some parts of the TOC to not have page numbers—you either have them for everything or for nothing, not for some and not others. So these appendix headings needed to go into a separate updateable and clickable list.

NOTE: You MUST be using a uniquely named style for your appendix headings, not Heading 1, etc. In the example below, the heading style for these level 1 appendix headings is ‘Appendix Heading’.

To add a new list of appendices to the front matter:

  1. Make sure you know the name of the style you use for the appendix headings.
  2. Go to the References tab > Captions group.
  3. Click Insert Table of Figures.
  4. On the Table of Figures dialog box, click Options.
  5. Select the style you use for the appendix headings from the styles list. In this example, the style is called Appendix Heading.
  6. Check the Style checkbox.
  7. Click OK to close the Table of Figures Options dialog box. (Ignore the web preview panel—it won’t show what you’ve chosen.)
  8. Optional: Clear the Show page numbers checkbox if you don’t want page numbers; leave it selected if you do.
  9. Click OK.
  10. If you already have a list of figures etc., you’ll be asked if you want to replace it. Click No.
  11. Your new list of appendices will be added to the front matter section.

To update your list:

  1. Click anywhere inside the list of appendices.
  2. Either:
    • Right-click and select Update Field, or
    • Go to the References tab > Captions group, then click Update Table.
  3. If asked, select the option to update the entire table.

 

h1

Word: Find a word surrounded by tags and make it bold

April 28, 2019

In a comment for this post (https://cybertext.wordpress.com/2011/06/20/word-replace-and-reformat-text-inside-square-brackets-using-wildcards/), Christopher asked how to replace a term surrounded by tags (e.g. [b]Whistle[/b]) so that the tags (the [b] and [/b] bits) are removed, the word is made bold, and a dash is added after the word (I’ve assumed an en dash).

Again, find and replace with wildcards come to the rescue. NOTE: The steps below will only replace single words, not two or more words within the tags.

  1. Press Ctrl+h to open the Find and Replace dialog.
  2. In the Find field, type: (\[b\])(<*>)(\[\/b\]) (it’s probably best to copy this as it’s easy to mistype it)
  3. In the Replace field, type: \2 ^= (Note: There are two spaces you need to type here: between the 2 and the ^, and after the =)
  4. While your cursor is in the Replace field, click Format, then Font, and choose Bold.
  5. Click Find Next. Assuming the word and its marks are selected correctly, click Replace.
  6. Repeat Step 5 until you’ve done them all. If you are confident you won’t break anything, click Replace All.

What this all means:

  • In the first Find element (surrounded by parentheses), you have to ‘escape’ the square brackets as they are special characters in a wildcard search. The escape character is \ and you have two square brackets, so therefore you have to type: (\[b\]) 
  • In the second Find element (surround by parentheses), < means the beginning of a word and > means the end of a word, with * representing any and all characters in that word. This is a single whole word only.
  • Just like in the first element, you have to escape the special characters in the third Find element with \. There are three of them to escape this time—two square brackets and a forward slash.
  • In the Replace, the \2 represents the second element (i.e. just the single word), which you’re replacing with itself. Next, there’s a space, followed by ^= which represents an en dash, followed by another space.
  • Finally (Step 4 above), you need to tell Word to bold the item you’re replacing.

Notes:

  • Depending on how the original words and tags were spaced, you may end up with two spaces after the en dash—a simple find for two spaces and replace with one space will sort those out.
  • Any words that have a space (or other non-letter character) immediately after the [b] tag or before the [/b] tag probably won’t be changed.
  • This only works for single words. If you have more than one word, you’ll either need a different find/replace, or, if there’s only a few, you can search for them after running this and fix them manually.

h1

Word: Webinar for Editors Canada

April 23, 2019

I’m doing a 90-minute webinar on Microsoft Word for Editors Canada on Wednesday this week. It’ll be at midnight my time, but between 9am and noon in the Americas, and late afternoon in Europe. You can register here: http://training.editors.ca/upcoming_webinar/save-time-and-your-sanity-increase-your-efficiency-with-microsoft-word-for-windows/

Even if you can’t attend, you can still register and get the recording, the slides, and the handouts afterwards.

Update: The webinar organiser ran two quick polls for me during the session—one about which version of Word attendees were using, the other about how involved they were in formatting Word documents for their clients. If I get screenshots or official results of these polls, I’ll post them here, but here’s what I remember:

  • ~90% of attendees were using Word 2010 to 2016 for Windows; ~10% were using Word for Mac. Interestingly, Microsoft touts that about 80% of Word users are now using Office 365, but that these results certainly don’t confirm that claim. Of course, Microsoft may not have polled heavy users of Word, such as editors, where I think they would get a very different result than what they claim for ALL Office users.
  • More than 50% of attendees were involved with formatting Word documents ‘often’ or ‘always’, about 30% ‘sometimes’, with only 15% saying ‘rarely’ and no-one stating ‘never’. However, these results could be skewed—the promotional information for the webinar mentioned that formatting would be one of the focus areas, so it’s possible those not involved in formatting may have chosen not to register.
h1

Word: Find multiple manually entered numbers and delete

April 22, 2019

I copied a very long manually numbered list (more than 300 numbered list items) from the internet into Notepad (to strip out the formatting), then into a Word document. Unfortunately, the numbers remained, and applying Word’s numbering didn’t get rid of them. What to do? Use Word’s Find and Replace with wildcards, of course!

My aim was to delete all the numbers and the space, en dash, space following each number, to end up with a list I could apply Word’s auto numbering to.

Here’s how I did it (NOTE: If you’re doing something similar, work on a COPY of your document first to make sure this works as you want it to):

  1. Open the Find and Replace dialog box (Ctrl+h).
  2. Click More.
  3. Select the Use Wildcards checkbox.
  4. In the Find what field, type: (<[0-9]@>)( – )
  5. Leave the Replace with field empty.
  6. Click Replace All.

Voilà! Almost all the numbers were gone, except for a few that used hyphens instead of en dashes or that didn’t have a space before or after the en dash, but I spotted these easily and fixed them manually.

How this works:

  • The first element (in the first set of parentheses) comprises several parts:
    • < and > indicate the beginning and end of a ‘word’, respectively
    • [0-9] indicates any number in the range from 0 to 9, and with the < in front of it, any ‘word’ that starts with a numeral
    • @ says to look for whatever immediately preceded this symbol as many times as required (i.e. a number from 0 to 9) until you reach the end of word marker (in other words, a whole number of any length)
  • The second element (second set of parentheses) looks for a space, en dash, space immediately following the number found in the first element
  • By leaving Replace with empty, you’re replacing whatever was found that matched the Find with nothing—in other words, you’re deleting whatever was found.