in Editing

Go Tell Microsoft!

Several readers have written to complain about Microsoft's "enhancements" of various features in Word 2002. Most notably, the Comments and Revision Tracking features are broken. I've written about these here:

http://www.topica.com/lists/editorium/read/message.html?mid=1710381892

http://www.topica.com/lists/editorium/read/message.html?mid=1711737396

Reader Ned Humphrey suggested starting a campaign to get Microsoft to reverse itself on such "disimprovements," which I thought was a great idea. So gentle reader, if you're so inclined, I'd like to enlist your help in asking Microsoft to change Comments and Revision Tracking back to the way they worked in Word 2000--or at least to give us the option of having them work the old way. Are you with me? ARE YOU WITH ME? (Sorry, I got a little carried away there.)

If you are, or if you have any other suggestions you'd like to give to Microsoft, you can do so here:

http://support.microsoft.com/default.aspx?scid=fh;[ln];feedback

Microsoft is asking for feedback, and I say we should give it to them. Please take a minute to click on the link above and send Microsoft your ideas. If we all work together, we should be able to help make a great word processor even better. And if you've ever wondered how to go about giving feedback to Microsoft, now you know how. Thanks for your help.

_________________________________________

READERS WRITE

Hilary Powers sent a correction to her serial comma macro that appeared in last week's newsletter. She wrote:

Everybody needs an editor. Turns out there's a mistake in my macro as presented--it won't ignore "andiron" at all. It needs to look like this instead:

'THE MACRO STARTS HERE
'Serial Macro
'Macro written 02/27/03 by Hilary Powers; updated 3/12
'
Selection.Find.ClearFormatting
With Selection.Find
.text = "and"
' REMOVED LEADING SPACE IN SEARCH STRING
.MatchCase = True
.MatchWholeWord = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=2
' BACK UP TWO SPACES BEHIND SEARCH STRING TO MAKE UP FOR DELETED SPACE
Selection.TypeText text:=","
'THE MACRO ENDS HERE

I didn't spot the problem until I contemplated the version in the newsletter and started wondering how it can find "whole words" on a string containing a space. I wrote that bit in rather than recording it, and the macro works without complaint--but it turns out that the string simply overrides that provision. So everything's fine as long as the next "and" string really is a whole word, but if it's not--a rare but possible thing--you get a comma there anyway.

If you don't know how to use macros like the one sent by Hilary, you can learn how here.

___________________________

Marty Spitzenberger sent in a way to insert serial commas using a wildcard Find and Replace. He wrote:

Type "([!,]) and>" (without the quotes) in the Find what field, and "1, and" in the Replace with field. Check the "Use Wildcards" box. Do Find Next. If the found text needs a comma, then do Replace. Since another Find Next is automatically performed after the Replace, exit the dialog box and do to return to the point of text replacement so the manual review can continue. This sequence can be recorded and saved as a macro.

The Find What text above translates to the following: find a group of one character that is not a comma, followed by one space character, followed by "and", which is the end of the word. This approach avoids a match to something like "black andirons."

Obviously, this will still find "Jack and Jill", which doesn't need a comma, but then so does last week's macro. This approach does avoid the extra steps in the macro of moving the cursor to the end of the previous word to insert the comma. The Replace With text translates to: replace the selection with the found group/character that wasn't a comma, then a comma followed by a space character and "and".

An improved search string would find sentences with a serial comma error in the form "I like a, b and c." This wildcard Find What string is:

(, [!.,:!?^013]@) and>

This search string finds the following sequence of characters:

a comma,

a space,

one or more characters that do not include period, comma, colon, exclamation mark, question mark, or paragraph mark

a space,

"and", which is the end of the word

The appropriate Replace With string is unchanged:

1, and

The search string limits the found text to appearing within one sentence of one paragraph, where the sentence contains a comma and then some other text without a comma immediately before " and". This way the search string avoids finding sentences in the form of "I like a and b." While it will incorrectly find sentences in the form of "Sadly, I like a and b.", it is still an improvement.

Another frequent task that can be simplified through wildcard search and replace is the deletion of extra paragraph marks inserted when a word-wrapped paragraph is converted to plain text. For example, my email as attached to your reply now has "> " at the beginning of each line and a paragraph mark at the end of each, with many short lines. Although transforming this text back into nice, word-wrapped paragraphs takes several steps, it is still quicker than doing each replacement manually:

1. Obviously, copy the desired text into a new word document.

2. Remove all of the "> " at the beginning of each line with this:

Find What: ^p>^032

(You can use a space character in place of the ^032 used here and elsewhere. I'm using ^032 to ensure that you enter a space.)

Replace With: ^p

Disable "Use wildcards"

Do Replace All

Note: The ^p at the beginning of the Find What is needed to avoid deleting a "> " string contained within paragraph text, which occurs here in the text representing key labels.

3. Review the text to ensure that there is a tab character starting each paragraph or a blank paragraph following each desired paragraph. Add any that are missing.

Note: Replacements in steps 4 and 5 are done to replace the paragraph mark with a space if a space isn't already before or after the para mark. The Find string also avoids replacing the paragraph mark if it is followed by a tab, under the assumption that this is an indented paragraph or a bullet.

4. Find What: ([!^013^032])^013([!^013^t^032])

Replace With: 1^0322

Check "Use wildcards"

Do Replace All

5. Find What: ([!^013])^013([!^013^t])

Replace With: 12

Check "Use wildcards"

Do Replace All

___________________________

Linda Duguay wrote:

I was recently faced with a request to create a macro to get rid of multiple blank lines in a document. This could happen when a document comes in as a text file or during a merge etc. I brought out my trusty book, Total Word Domination, that you wrote and went to work on the problem using wildcards.

A caveat in this case: there were blank lines between paragraphs (it was a text file so no paragraph spacing) and we wanted to delete them (the first Find command). But we didn't want to delete the actual carriage return at the end of the paragraph, so we searched for two carriage returns and replaced them with one. With all of the double carriage returns out of the picture, we could now search for all occurrences of three or more carriage returns and delete those (the second Find command). It was very fast and did the job. We had over 1,000 pages reduced to 1 page in seconds.

In the case where you want two carriage returns to separate paragraphs, you can either not use the first Find routine or using a message box to ask if this is wanted.

Here is what I came up with:

'THE MACRO STARTS HERE
Dim myRange As Range
ActiveDocument.Bookmarks.Add Name:="TempDBP", Range:=Selection.Range
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^13{2}"
.Replacement.Text = "^13"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "^13{2,}"
.Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With ActiveDocument.Bookmarks("TempDBP")
.Select
.Delete
End With
'THE MACRO ENDS HERE

___________________________

From: Phil Rabichow [mailto:phrab@earthlink.net]

The last issue of Editorium pointed out that you can search for ^013 when you're looking for a paragraph mark. You can also use ^13 (just one keystroke less, I know). Anyhow, here is a list of Find/Replace codes:

These you can use when you don't use wildcards:

^p Paragraph mark

^t Tab character

^a Annotation (comment) mark

^0nnn ANSI (4 digit) or ASCII (3 digit) characters, where nnn is the character code

^? Any character

^# Any digit

^$ Any letter

^^ Caret character

^c Clipboard contents

^& Contents of the Find What box

^e Endnote mark

^d Field

^f Footnote mark

^g Graphic

BREAKS

^n Column break

^l Line break

^m Manual page break

^b Section break

HYPHENS AND SPACES

^+ Em dash

^= En dash

^s Nonbreaking space

^~ Nonbreaking hyphen

^- Optional hyphen

^w White space

Here is a list that you can use in Find when using wildcards:

^1 Picture (Except pictures with Float Over Text property, Word 98

Macintosh Edition)

^2 Auto-referenced footnotes

^5 Comment mark

^9 Tab

^11 New line

^12 Page OR section break

^13 Carriage return

^14 Column break

^19 Opening field brace (when the field braces are visible)

^21 Closing field brace (when the field braces are visible)

^? Word 6.x and later: Any single character (not valid in the Replace

box)

^- Optional hyphen

^~ Non-breaking hyphen

^^ Caret character

^# Any digit (Word 6.x and later)

^$ Any letter (Word 6.x and later)

^& Contents of Find What box (Replace box only) (Word 6.x and later)

^+ Em Dash (not valid in the Replace box) (Word 6.x and later)

^= En Dash (not valid in the Replace box) (Word 6.x and later)

^u8195 Em Space Unicode character value search (not valid in the

Replace box)

^u8194 En Space Unicode character value search (not valid in the

Replace box)

^a Comment (not valid in the Replace box) (Word 6.x - Word 7.0)

^b Section Break (not valid in the Replace box) (Word 6.x and later)

^c Replace with Clipboard contents (Replace box only)

^d Field(Word 6.x and later)

^e Endnote Mark (not valid in the Replace box) (Word 6.x and later)

^f Footnote Mark (not valid in the Replace box) (Word 6.x and later)

^g Graphic(Word 6.x and later)

^l New line

^m Manual Page Break (Word 6.x and later)

^n Column break (Word 6.x and later)

^t Tab

^p Paragraph mark

^s Non-breaking space

^w White space (space, non-breaking space, tab; not valid in the

Replace box)

^nnn Where "n" is an ASCII character number

^0nnn Same as above, but uses ANSI characters (ALT+nnn PC only)

^unnnn Word 97 Unicode character search where "n" is a decimal number corresponding to the Unicode character value.

Thanks to one and all for their useful suggestions.

_________________________________________

RESOURCES

If you haven't yet signed up for Allen Wyatt's wonderful WordTips newsletter, you're missing some of the best tips and tricks around. The perfect complement to Editorium Update, WordTips provides a weekly helping of quick, helpful hints for beginners and experts alike. You can learn more and sign up here:

http://www.vitalnews.com/wordtips/

Webmentions

  • online sports betting

    make money fast

    Go Tell Microsoft!