Shifting Styles, Part 4

You're typing along, and suddenly the short line you entered a couple of paragraphs earlier has turned big and bold. Who does it think it is, anyway? When you investigate, you discover that the line has somehow been formatted with Word's Heading 1 style.

You've just discovered one of the wonders of Word's AutoFormat feature, which should be firmly beaten into submission before it takes over your whole document. If you want to see how it works, try this:

1. Click the "Format" menu.

2. Click "AutoFormat."

3. Click the "Options" button.

4. Click the tab labeled "AutoFormat As You Type."

5. Under "Apply as you type," put a check in the box labeled "Headings." If there's already a check there, you've found the source of your anguish.

6. Click the "OK" button.

7. Click the "Close" button.

Now, in a new document, do this:

1. Type "My Heading" (without the quotation marks), and be sure not to type any punctuation after it.

2. Hit the Enter key twice.

Wow, the text is now formatted with the Heading 1 style. You might think that's kind of neat, but what if you didn't *want* the text to be a heading? What if you were just typing a list of items without ending punctuation (which, by the way, seems to be the defining factor here)? Then you need to turn the feature off.

See, the whole issue is one of control. How much "help" do you want Microsoft Word to give you? If you're editing, your answer may be "none," because editors need to have complete control over what's happening, and they can't have Word introducing changes that they may not even be aware of. When I'm editing, I allow one AutoFormat option--replace "straight quotes" with "smart quotes" as I type--and I watch it like a hawk.

If you turn off the AutoFormat option to apply headings as you type, and you *still* get automatic formatting, you may still have the last "AutoFormat As You Type" option turned on. It's labeled "Define styles based on your formatting," and the Tooltip Help explains its function:

"Create new paragraph styles based on the manual formatting you apply in your documents. You can apply these styles in your document to save time and to give your documents a consistent 'look.'"

The idea that Word is creating new styles as I work just gives me the heebie-jeebies. This is one option I'm definitely going to keep turned off.

_________________________________________

READERS WRITE

On April 10, Editorium Update featured a macro to convert typed-in fractions (like 1/2) into typographically acceptable ones (like 1/2). You can read the article here:

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

In the article, I wrote, "I owe my thanks to Wordmeister Steve Hudson for the idea. Steve would probably take a more elegant approach, but this macro will definitely work." Well, by golly, Steve did create a beauty of a macro (the Fractionator) that even watches out for dates (4/10/2001, for example) and URLs and leaves them alone, while still creating beautiful fractions. Many thanks to Steve for this useful tool, and for his comments throughout the macro to explain what is going on.

If you don't know how to use macros like this one, you can learn more here.

You might also want to create a toolbar button for the macro, which you can learn about here:

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

And now, the macro:

'THE MACRO STARTS HERE
Private Const msgNoFraction As String = "No fractions found."
Private Const hitInfo As String = "Information"
Public Sub TextFormatAllFractions()
System.Cursor = wdCursorWait
If FractionFormatting = 0 Then MsgBox msgNoFraction, , hitInfo
System.Cursor = wdCursorNormal
End Sub
Public Function FractionFormatting(Optional Scope As Range) As Long
'returns the number of entries formatted
'formats 123/456 with super and subscript
'The Word Heretic
Const Search As String = "[0-9]@^47[0-9]@"
Dim Fractionator As String
Dim Divisor As Range
Dim Dividend As Range
Dim Slash As Range
Dim Finder As Range
Dim TestStart As Range
Dim TestEnd As Range
Dim IsFraction As Boolean
Dim StartChar As String
Dim EndChar As String
Const UrlText As String = "?%#_|$/"
If Scope Is Nothing Then Set Scope =
ActiveDocument.StoryRanges(wdMainTextStory)
Fractionator = ChrW$(8260) 'unicode
Set Finder = ActiveDocument.StoryRanges(wdMainTextStory)
Finder.Collapse
With Finder.Find
.Text = Search
'only search forwards
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
While .Execute(replace:=wdReplaceNone)
FractionFormatting = True
Set Divisor = Finder.Duplicate
Set Dividend = Finder.Duplicate
'divisor is the bit at the end
'so move start until we find a slash
Divisor.MoveStartUntil cset:="/"
'then move just past it
Divisor.MoveStart unit:=wdCharacter, Count:=1
' now make sure we get the rest of the number
' (Word's Find wildcards feature sux)
Divisor.MoveEndWhile cset:="0123456789"
'dividend is the bit at the start
'so start from the beginning
Dividend.Collapse
'include everything up to the slash
Dividend.MoveEndUntil cset:="/"
'The slash is right after our dividend
Set Slash = Dividend.Duplicate
'so start at the end
Slash.Collapse wdCollapseEnd
'and move forward 1!
Slash.MoveEnd unit:=wdCharacter, Count:=1
'Now, test if it is a fraction or part of a bigger formula.
'First, get the chars immediately before and after
Set TestStart = Dividend.Duplicate
TestStart.Collapse
TestStart.MoveStart unit:=wdCharacter, Count:=-1
Set TestEnd = Divisor.Duplicate
TestEnd.Collapse Direction:=wdCollapseEnd
TestEnd.MoveEnd unit:=wdCharacter, Count:=1
StartChar = TestStart.Text
EndChar = TestEnd.Text
IsFraction = True 'innocent until proven guilty
'Check if this is a field. Its probably a hyperlink or similar
'So don't process it
If Slash.Fields.Count > 0 Then IsFraction = False
'Test for some obvious false positives
If (LCase$(EndChar) >= "a" And LCase$(EndChar) <= "z") Or _
(LCase$(StartChar) >= "a" And LCase$(StartChar) <= "z") Or _
InStr(1, UrlText & ".", StartChar) > 0 Or _
InStr(1, UrlText, EndChar) > 0 Then IsFraction = False
If IsFraction Then
'set the styles at LAST!
Dividend.Font.Superscript = True
Divisor.Font.Subscript = True
Slash.Text = Fractionator
FractionFormatting = FractionFormatting + 1
End If
'Now, set the find range so we find
'the next fraction
Finder.Collapse wdCollapseEnd
Wend
End With
End Function
'THE MACRO ENDS HERE

_________________________________________

RESOURCES

Speaking of Steve Hudson, Steve sent a bunch of his favorite resources, one of which is the Qwik and Dirty Task Guide for Microsoft Word:

http://www.oootraining.com/QwikAndDirty/QwikAndDirtyWordWeb/qwikword.htm

The Web site notes, "We'll show you how to do multi-step tasks in Microsoft Word by guiding you through the screen sequences. Scroll down, as needed. We use very few words, but realistic examples."

The site features clear, illustrated, step-by-step instructions for using various features of Microsoft Word, and a handy table of contents for easy navigation. Especially if you're just starting out with Word, you'll find this site invaluable.

This entry was posted in Editing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@editorium.com

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone. Period.

    If you’d like to subscribe, please enter your name and email address below. We publish the newsletter once a week, and on rare occasions we may send an important announcement. We never, ever send spam. Thank you for signing up!