Archive for the ‘Word’ Category

h1

Word: All linked fields no longer linked, all styles set to Normal

June 6, 2023

Warning! Opening a Word document in Google Docs automatically strips all linked cross-reference fields and converts them to plain text and renames all named styles (except Heading 1, 2, 3 etc.) to Normal. 

There’s a long story attached to this, but I’ll give you the short version—a client sent me back some docs that I’d reformatted for them saying the cross-references didn’t work and that there were other things wrong with the document.

After quite a bit of sleuthing (multiple systems, multiple users, multiple companies, multiple storage and file sharing software and locations), I’ve been able to replicate seeing a well-formatted, complex document turn into, basically, plain text, in just seconds. And what did this? Google Docs!

If you share a Word file in Google Drive it should be fine (upload, download only), but DO NOT open that file from within Google Drive, even just to take a peek at it. Doing so opens it in Google Docs, which then automatically strips a lot of Word features from the document. If you then either save it as a Word document from within Google Docs (via Download > Microsoft Word (.docx)), or close it and download it from Google Drive on the assumption it hasn’t been opened, the document will have lost many of the Word features you may have used.

You don’t have to do have done anything in the document. Google Docs doesn’t have a manual ‘save’ feature; instead it auto saves every few seconds. So just opening the Word document WITHOUT DOING A THING then saving it as a Word document or just closing it will break it. And then you have to reassign all the styles in Word (in my case, one doc was 500 pages with LOTS of styles) and reassign all the figure and table captions, and then relink the cross-references (1600+ in one document and a similar number in another), and waste several days of your life doing this. Or use the compare documents feature in Word if that’s easier and manually copy across the changes to the original ‘clean’ document.

Safer options would be to use another file sharing option such as Dropbox.com or Microsoft’s OneDrive. Google Drive is good for storing and sharing many things… but not for complex Word documents—it’s WAY too easy to break the document.

Update and more information:

Things that break:

  • All cross-references revert to plain text, so a x-ref field for Table 1-1 will now say Table 1-1 but it is no longer a field and therefore no longer clickable. (General advice: Turn on field shading in Word to see what’s a field [it will have a grey background] and what’s not [plain background]; do this via File > Options > Advanced, scroll to Show Document Content, then set Field Shading to Always)
  • All caption numbering reverts to plain text, as above. As a consequence, the cross-reference dialog box for selecting a table or figure is empty.
  • All style names (except heading styles, and perhaps a few others) used in the doc now show as ‘Normal’ when you check what style is assigned to the paragraph, but the formatting of that original style is kept—it looks like it’s correct, but it’s not. I think Google Docs has preserved the styling as direct (manual) styling on top of ‘Normal’. For example, if you have a style called Table Text that’s set to 9pt Arial, it will still be 9pt Arial, but it now shows in the Styles pane as being the ‘Normal’ style, not ‘Table Text’ as it was in the Word document. This means you can’t globally change the settings for a style as Word thinks it’s ‘Normal’, and if you change the settings for ‘Normal’, this may have unintended and very messy consequences (no, I didn’t try this!). And when you change the Styles pane setting to show styles In Use, you get a very limited list.
  • All document property and inserted fields for various things throughout the document and in headers and footers revert to plain text.

Things that don’t break:

  • The TOC is preserved. It may look a little different but it’s still there.
  • Some styles are preserved, such as Heading 1, 2, 3 etc., Title, Subtitle, TOC 1, 2, 3 etc. and, of course, Normal. I think because Google Docs uses those style names.
  • Hyperlinks to email or web addresses are preserved.
  • Paragraph ‘keep with next’ attribute is preserved, even if it’s not assigned to a Heading style.
  • Page numbers are preserved.
  • Tables and figures are preserved.
h1

Word: Find text between chevron arrows and highlight it

May 26, 2023

Jefferson asked how he could use a wildcard search to find text between ‘chevron’ arrows, i.e. the less than (<) and greater than (>) symbols on the keyboard above the comma and period keys.

I wasn’t sure what he wanted to do with that text once found—bold it, italicise it, highlight it, etc.—so this post shows you how to highlight it. If you want to do something else, then you’d change the Font setting at Step 8 below.

NOTE: This find/replace finds ALL words between a matching set of < and > symbols, so if you only use one (say, for less than) and not the other for several pages, then all the text in the pages in between will be highlighted.

  1. Before you start, select a highlight colour from the Home tab on the ribbon (this is essential if you’re intending to highlight the text found).
  2. Press Ctrl+h to open the Find and Replace window.
  3. Click More.
  4. Select the Use wildcards checkbox.
  5. In the Find field, type: (\<)(*)(\>)
  6. In the Replace field, type: \1\2\3
  7. At the bottom of the window, click Format.
  8. Select Highlight. (If you want bold or italic, select Font instead, then Bold or Italic).
  9. Check that the formatting you want is shown BELOW the Replace field (see screenshot).
  10. Click Find Next then Replace for each one found (ONLY press Replace All if you are absolutely certain that every opening chevron arrow has a closing one, and that there are no mathematical uses for the chevrons).

How this works

  • Chevron arrows are special characters in a wildcard search so they must be ‘escaped’ to act as chevrons—you do this by placing a \ immediately before the special character, so for each you would write them as \< and \>
  • Any characters and any number of characters is expressed using an asterisk  *
  • The parentheses separate each part of the Find, so (\<) looks for an opening chevron, then (*) looks for ANY and ALL characters after the opening chevron, and (\>) looks for the closing chevron. In other words, find anything between an opening and closing chevron, whether it’s a single character or a bunch of words.
  • In the Replace, the \1\2\3 tell Word to replace the first, second and third parts of the Find with themselves; i.e. make no change.
  • The formatting under the Replace field tells Word to format the replace string with the formatting selected (i.e. in this case, highlight the original words and the chevrons in the highlight colour selected in Step 1 in this example).
h1

Word: Use the keyboard to add a word to the dictionary

April 23, 2023

In the category of ‘OMG—I didn’t know I could do that!!’ comes this tip from Allen Wyatt’s WordTips newsletter: https://wordribbon.tips.net/T010898_Spell-Checking_from_the_Keyboard.html where he describes several ways of using the keyboard instead of right-clicking with the mouse to add a word to the dictionary.

I just tested the ‘right-click’ button on my keyboard on a misspelled word in Word and it does as he says! But more importantly, it’s not just for adding words to the dictionary—in fact, you can use it ANYWHERE and in ANY program where right-click options are available (including your browser, desktop etc.) and, depending on the context, you’ll get the relevant shortcut menu displayed, from which you can use the arrow keys to navigate to the function you want.

I guess I’ve never really noticed some of the newer keys on the keyboard over the years (I started with computers in the mid-80s, getting my first PC in 1994). And if I knew about that right-click key at any point, I’d forgotten about it.

So, where is this magic key? On 104-key Windows keyboards it’s immediately left of the Ctrl key on the right. Try it out! (I have no idea if there’s anything similar on a Mac)

h1

Word: Quick tips for find and replace

April 19, 2023

The Office Watch newsletter has compiled a brief summary of the main types of searches (find and replace) you can do in Word: https://office-watch.com/2023/find-more-and-faster-in-word-using-these-tricks/

You can access these options another way too: press Ctrl+h to open the Find and Replace window.

[Link last checked April 2023]

h1

Word: Make all instances of a specific word a hyperlink to a URL

April 18, 2023

Here’s a curly one that one of my readers asked this weekend: ‘Do you know how to add a hyperlink in VBA to a specific word so that every time the specific word is displayed in the document it has the hyperlink in it?’

The answer to that specific question is ‘no’, but I thought I’d try to find out if there’s another way to do this using find and replace.

And there is, but all the usual warnings apply as I’ve only tested this for a few minutes and only for a website link. I don’t have the knowledge to make this into a macro or even better, to make it into a macro or autocorrect so that when you type the word, it automatically becomes a hyperlink (though Method 2 below describes how to create it as AutoText). Some of my clever readers may be able to figure out how to do this with a macro…

Warnings

  • DO NOT try this on your main document—always test on a backup copy to check that no inadvertent changes or errors are introduced.
  • This procedure only changes ONE word or phrase to a hyperlink, not multiple different words/phrases. You would have to do each as a separate find/replace run. Or create an AutoText ‘snippet’ for each.
  • You will be replacing with something you copy to the clipboard so don’t copy ANYTHING to the clipboard in between starting and finishing this (ask me how I know…)
  • DO NOT click Replace All unless you are ABSOLUTELY sure you won’t change something you weren’t expecting to change.

Method 1: Find and Replace

This method is best done after you’ve written the document.

Step 1: Set up the link

  1. In a Word document, type the text you want to apply the link to, then select it.
  2. Right-click on the selected text and select Link from the shortcut menu (or go to the Insert tab > Link > Insert link).
  3. The text you selected is in the Text to display field—check it is correct.
  4. Go to the Address field at the bottom of the Insert Hyperlink window.
  5. Type the full URL for the website, then click OK.
  6. By default, the selected text will now be a blue underlined hyperlink—hover over the hyperlink to make sure that it will go to the correct URL (and to be certain that it’s correct, press Ctrl+click to open the website in your browser).
  7. Copy the blue underlined word/phrase using Ctrl+c. DO NOT copy anything else after you have done this.

Step 2: Find other instances of the word/phrase and replace with the hyperlinked word/phrase

  1. Press Ctrl+h to open the Find and Replace window.
  2. In the Find what field, type the text you want to replace (it should be the same as the text you typed/selected in the first step of the Step 1 series of steps above).
  3. Optional: Click More and select Match Case and/or Find whole words only (only an option for a single word).
  4. In the Replace with field, type ^c
    (NOTE: Press Shift+6 to get the caret symbol, make sure there are no spaces, and type a lower case ‘c’).
  5. Click Find Next.
  6. When you find a matching word/phrase that you want to change to the hyperlinked one, press Replace. If you don’t want to replace a particular instance, click Find Next.
  7. Repeat Step 6 until you have replaced all those you want to be hyperlinks.

Method 2: AutoText

Instead of find/replace, you could set up the hyperlinked word/phrase as AutoText and then insert that as you needed it. This method is best used when you’re writing the document, and is ideal if you have something like a company name that you want to have linked to a URL across many documents.

Step 1: Set up the link and AutoText

  1. In a Word document, type the text you want to apply the link to, then select it.
  2. Right-click on the selected text and select Link from the shortcut menu (or go to the Insert tab > Link > Insert link).
  3. The text you selected is in the Text to display field—check it is correct.
  4. Go to the Address field at the bottom of the Insert Hyperlink window.
  5. Type the full URL for the website, then click OK.
  6. By default, the selected text will now be a blue underlined hyperlink—hover over the hyperlink to make sure that it will go to the correct URL (and to be certain that it’s correct, press Ctrl+click to open the website in your browser).
  7. With the text still selected, go to the Insert tab > Quick parts > AutoText > Save selection to AutoText gallery.
  8. If you’re happy with the defaults on the Create New Building Block window (and mostly they are fine, though you may like to add an underscore to the name if you want it to appear near the top of the list), click OK to create the AutoText. (NOTE: The default save location is the Normal.dotm template, but if your documents use another template, you’ll likely be better off choosing the Building Blocks.dotx file to save it to. The other advantage of this is that if Word crashes badly, Normal.dotm gets rebuilt to the factory defaults and you will lose any AutoText stored there [as well as macros, keyboard shortcuts, etc.), whereas Building Block.dotx should be preserved in a crash.)

Step 2: Add the AutoText as you’re writing

  1. When you’re ready to add the hyperlinked AutoText to your document, go to the Insert tab > Quick parts > AutoText then find the AutoText snippet in the gallery.
  2. You can just click it to insert where you are in the document, or you can right-click on it to insert it in other places in the document (e.g. header, footer).
  3.  The AutoText snippet will remain in your AutoText list to use as many times as you want and across as many documents as you want.

More information, in case you’re interested 

All links and fields have underlying code, which you may never see—you just see the blue underlining or the grey shading if you have field shading turned on. But if you’re interested in what the code for a link or a field looks like, press Alt+F9. Note: ALL the links and field codes throughout your document will change to show their underlying code. Don’t freak out (see https://cybertext.wordpress.com/2011/09/06/word-freaky-field-codes-on-display/)—you can change them back just as quickly by pressing Alt+F9 again.

What you’ll see in the underlying code for a web link is something like this:

And when you revert back to normal text, it will look something like this:

h1

Word: Replace ‘to’ in a number range with a dash

March 26, 2023

Pam asked if I could help her with a wildcard search for replacing the ‘to’ in a number range (e.g. 1.65 to 2.30) with a dash (in this case, she wanted a dash (also known as a hyphen—the one on the top of a keyboard), not an en dash, which would be typical for a number range). She PROMISED she wouldn’t do ‘replace all’, and if you’re doing this, please don’t use ‘replace all’ as you may change some things that aren’t number ranges (e.g. They each gave $25 to 10 people).

These instructions are for Word for Windows; Word for Mac should be the same once you get to its Find and Replace window:

  1. Press Ctrl+h to open the Find and Replace window.
  2. Click More.
  3. Select the Use wildcards checkbox.
  4. In the Find, type: ([0-9])( to )([0-9]) 
    (NOTE: There is a single space either side of the ‘to’)
  5. In the Replace, type: \1-\3
    (NOTE: This adds a standard dash; if you want an en dash, replace the standard dash with an en dash, which you can get by pressing Ctrl+[minus] on the number pad of a standard keyboard.)
  6. Click Find Next, then Replace if the instance found meets your criteria. Repeat.

How this works:

  • ([0-9]) represents any single numerical digit from 0 to 9
  • ( to ) looks for ‘to’ surrounded by a single space either side
  • \1-\3 replaces the first instance of ([0-9]) with itself (i.e. no change), then adds a dash, then replaces the second instance of ([0-9]) with itself (i.e. no change).

Update: Adrienne Montgomerie decided to test ChatGPT on creating a wildcard search for this. Here are her results: https://scieditor.ca/2023/03/editor-and-ai-wildcard-searches/

h1

Word: Find and replace maintaining original capitalisation

March 23, 2023

Sean had a problem: ‘I need to replace a fully capitalised term (EMBA) with a title one (Planning Area), but doing the standard Find/Replace just gives me a capitalised version (i.e. PLANNING AREA) throughout. Is there an easy fix/trick for this?’

Sure is, Sean!

  1. Save your document. (Always standard practice before making potential global changes—if anything goes wrong, you can always close without saving and your global changes won’t be saved but you will have saved all your earlier changes)
  2. Turn OFF track changes unless you specifically need them on for this.
  3. Press Ctrl+H to open the Find/Replace window.
  4. Click More.
  5. In the Find, type EMBA
  6. Select the Match Case AND Find Whole Words Only checkboxes.
  7. In the Replace, type Planning Area
  8. Click Find Next, then Replace.
  9. Check that it worked OK (it should), then if confident, click Replace All. It’s safer to do Find Next then Replace than Replace All, but having specified the match case AND find whole words only, you shouldn’t get any nasties (such as replacing ‘EMBARKATION’ with ‘Planning AreaRKATION’).

NOTE: Match case and Find whole words only will remain as the default filters for any future searches while the Word document is open, so I suggest you go back and turn those off once you’re done, otherwise your standard Ctrl+F searches will apply those filters too.

h1

That’s what you pay me for

March 17, 2023

A client had an URGENT issue with a Word document. Urgent because something broke (heading outline numbering in this case) and they were on a drop-dead deadline to get the document to the federal government regulator TODAY. I tried a couple of things (one of which caused a track changes issue—even though track changes was turned OFF—that couldn’t be fixed quickly), before applying a fix that I was pretty sure would work, which it did. They were MOST grateful I could fix it.

Sometimes people want to quibble on things like rates, but then something like this happens and I can fix it in 15 mins because of my prior experience with Word (I’ve used Word since the early 1990s, and it’s been my primary work tool since 2008). You realise that you (and others) could’ve spent all day on it and still not solved it, with all the stress that comes with that because you know that it costs bucketloads of $$$$$ when documents due to go to regulators aren’t submitted on time. I certainly don’t claim to be able to fix everything, but I have a handle on some places in Word where others fear to tread!

It’s just like if I had a problem with my car or computer. I’d see if it was something I could figure out within a few minutes, and then I’d call in the experts. The cost of you (+ others) agonising over this is far greater than the cost of getting me to do it. Ultimately, what you’re paying me for is my decades of learning and expertise, just like you pay your mechanic for the knowledge and expertise they have to be able fix your car or your computer people to fix your computer.

BTW, the issue the client had was that they’d lost all their outline numbering for headings (heading levels 1 to 5 in a 350+ page document). When I asked if they’d worked on it WITHIN SharePoint after receiving it back from me yesterday, they said ‘yes’. I have a suspicion that what happened to them is related to this issue I came across several months ago, which I also suspect is related to working on a document within SharePoint: https://cybertext.wordpress.com/2022/08/04/word-outline-numbered-headings-start-at-a-number-other-than-1/

h1

Word: A cautionary tale about Replace All

March 11, 2023

A cautionary tale about clicking Replace All when doing find and replace in Word…

The 150p document I was working on had a LOT (more than 5000) instances of values with abbreviated units of measure per hour (e.g. km/hr, m3/hr) in their many tables. However, they’d used ‘hr’ as the abbreviation for hour instead of the standard abbreviated SI unit, which is ‘h’. This was a job for find and replace!

My initial find was set to ‘hr’ with ‘h’ as the replacement and I was going to click Replace All (with more than 5000, clicking Find Next just wasn’t an efficient option). However, at the last minute I decided to add the slash to narrow the find and replace to just ‘/hr’, replacing with ‘/h’, before clicking Replace All.

Had I not done so and clicked Replace All, hundreds of words like through, threat, throughout, shred, breakthrough, etc. would have changed too! And spellcheck would not have saved me for some of these (e.g. through => though; shred ==> shed).

h1

Word: Shift punctuation to after a closing parenthesis

March 6, 2023

An editor on one of my editing Facebook groups put out a call for help. They wanted to find instances where punctuation preceded an opening parenthesis (typically used for a citation) and if possible, move that punctuation to after the closing parenthesis. For example: ‘Life is good. (Jones 2022) Here is the next sentence.’ should be ‘Life is good (Jones 2022). Here is the next sentence.’

In their example, the only punctuation is a period, but it could be a comma, semicolon or a full colon. (I’ll ignore exclamation points and question marks as they don’t play well with Word’s wildcard find as they are special characters used in wildcards.)

As with any find/replace, you need to identify the pattern you’re looking for—in this case, a punctuation character followed by a single space then an opening parenthesis, then varying text and numerals, followed by a closing parenthesis.

This is an ideal situation for wildcards! However, any such changes done globally could have unintended consequences, so my recommendation is to NOT click Replace All—instead, click Find Next followed by Replace once you’ve determined nothing will go wrong. The biggest thing that could go wrong is that there could be a citation that didn’t have a closing parenthesis immediately after it, in which case this find/replace would find the next closing parenthesis, which may not be part of a citation at all. Bottom line: DON’T click Replace All.

  1. Press Ctrl+h to open the Find/Replace window.
  2. Click More.
  3. Click the Use wildcards checkbox.
  4. In the Find What field, type (or, preferably, copy then paste) this:  ([.,;:])( )([\(])(*)([\)])
  5. In the Replace With field, type (or copy/paste) this: \2\3\4\5\1
  6. Click Find Next. If a correct string is found, click Replace (otherwise, click Find Next to see if the next one is a match you want to change). Repeat.

How this works:

  • There are 5 elements to the Find, with each enclosed in parentheses. Each element is represented internally within Word by a number, so the first element is treated as 1, the second as 2 etc. This becomes important for the Replace because you’ll use those numbers to represent what’s in the Find, and will reorder them to place the punctuation after the closing parenthesis.
    • The 1st element in the Find is ([.,;:]) — The outside parens tell Word to treat this element as one thing, the square brackets tell Word that the items within those brackets are the range of characters to find—in this case any comma, period, semicolon or colon.
    • The 2nd element in the Find is ( ) — The outside parens tell Word to treat this element as one thing, and inside the parens is a single space. So, look for the first element (any one of those punctuation characters), followed immediately by a space.
    • The 3rd element in the Find is ([\(]) — The outside parens tell Word to treat this element as one thing, the square brackets tell Word to find the character within those brackets—in this case an opening parenthesis. NOTE: Because parentheses are special characters in wildcard find/replace, you MUST ‘escape’ the character (using a \ )to tell Word to treat the opening parenthesis as a parenthesis and not as a special command. Our search string is growing and now means look for the first element (any one of those punctuation characters), followed immediately by a space, followed immediately by an opening parenthesis.
    • The 4th element in the Find is (*) — This is the command that is the potentially dangerous one and the reason why I advise you to NOT use Replace All with this find/replace—an asterisk inside parens like this tells Word to find ANYTHING. Any character, any numeral, any punctuation, any space, any tab… anything! And any number of them. Our search string now tells Word to look for the first element (any one of those punctuation characters), followed immediately by a space, followed immediately by an opening parenthesis, followed by ANYTHING until it gets to the 5th and final element (below), which is the closing parens.
    • The 5th and final element in the Find is ([\)]) — Explanation as for the 3rd element, but this time you need to ‘escape’ the closing parenthesis.
  • The Replace string is simple: When Word finds the matching pattern for the search, rearrange the elements above in this order: 2, 3, 4, 5 then 1 (the \ separates these numbered elements; note there’s no spaces between this string of numbers—if you add a space, then that would get added in the result in that place too). In other words, keep elements 2, 3, 4, and 5 in the same order, but move element 1 and put it after element 5. Because element 1 is the punctuation and element 5 is the closing parenthesis, the punctuation will now come after the parenthesis and be removed from before it.