Adjusting Word Spacing
November 3, 2004 – 12:00 pmOur previous newsletter included macros for condensing or expanding line spacing (leading) in selected paragraphs. If you’re trying to eliminate widows and orphans, however, it’s often better to condense or expand word spacing and leave leading alone. In Microsoft Word, you can easily condense or expand *character* spacing (Format > Font > Character Spacing > Spacing). But to adjust *word* spacing, you have to individually select spaces between words and then individually condense or expand them. Too much work! But a macro could do it for you.
Here are two macros, one to condense word spacing and one to expand it. The best way to use these macros is to hook them up to a couple of keyboard shortcuts. CTRL + comma and CTRL + period are good choices because the comma and period keys are also marked with < and >, which could be thought of as “less” (decrease) and “more” (increase). If you need instructions on how to assign keyboard shortcuts to macros, you’ll find them here:
http://www.topica.com/lists/editorium/read/message.html?mid=1707100224
(Scroll down to the Reader’s Write column.)
To use one of the macros, select the text whose word spacing you want to condense or expand. Then run the macro over and over until the type looks the way you want it to. Each time you run it, word spacing for the selected text will be adjusted by 0.05 of a point, and you’ll see the current adjustment (in points) in the lower left corner of your Word window.
Remember that if you type something to the right of one of your adjusted spaces, whatever you type will also be adjusted. To prevent that from happening, press CTRL + SPACE before typing.
And now, here are the macros, which I hope you’ll find useful. If you don’t know how to use such macros, you can learn how here:
http://lists.topica.com/lists/editorium/read/message.html?mid=17069228 55
Sub CondenseWordSpacing()
Dim CurrentFontSpacing$
Dim CurrentFontSpacing_
‘See if text is selected
If WordBasic.GetSelStartPos() <> _
WordBasic.GetSelEndPos() Then
WordBasic.EditBookmark “tmp0″
Else
GoTo EndMacro
End If
‘Go to first space in selection
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.EditFind Find:=”^w”
If WordBasic.EditFindFound() = 0 _
Then GoTo EndMacro
‘Calculate new size for space
Dim dlgFont As Object
Set dlgFont = _
WordBasic.DialogRecord.FormatFont(False)
WordBasic.CurValues.FormatFont dlgFont
CurrentFontSpacing$ = dlgFont.Spacing
CurrentFontSpacing_ = _
WordBasic.Val(CurrentFontSpacing$) - 0.05
CurrentFontSpacing$ = _
WordBasic.[LTrim$](Str(CurrentFontSpacing_)) _
+ ” pt”
‘Apply new size to spaces in selected text
WordBasic.WW7_EditGoTo “tmp0″
WordBasic.EditBookmark “tmp0″, Delete:=1
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.EditReplaceFont _
Spacing:=CurrentFontSpacing$
WordBasic.EditReplace _
Find:=”^w”, Replace:=”^&”, ReplaceAll:=1, Format:=1
WordBasic.PrintStatusBar “Spaces adjusted by ” + _
CurrentFontSpacing$ + “.”
EndMacro:
End Sub
Sub ExpandWordSpacing()
Dim CurrentFontSpacing$
Dim CurrentFontSpacing_
‘See if text is selected
If WordBasic.GetSelStartPos() <> _
WordBasic.GetSelEndPos() Then
WordBasic.EditBookmark “tmp0″
Else
GoTo EndMacro
End If
‘Go to first space in selection
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.EditFind Find:=”^w”
If WordBasic.EditFindFound() = 0 _
Then GoTo EndMacro
‘Calculate new size for space
Dim dlgFont As Object
Set dlgFont = _
WordBasic.DialogRecord.FormatFont(False)
WordBasic.CurValues.FormatFont dlgFont
CurrentFontSpacing$ = dlgFont.Spacing
CurrentFontSpacing_ = _
WordBasic.Val(CurrentFontSpacing$) + 0.05
CurrentFontSpacing$ = _
WordBasic.[LTrim$](Str(CurrentFontSpacing_)) _
+ ” pt”
‘Apply new size to spaces in selected text
WordBasic.WW7_EditGoTo “tmp0″
WordBasic.EditBookmark “tmp0″, Delete:=1
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.EditReplaceFont _
Spacing:=CurrentFontSpacing$
WordBasic.EditReplace _
Find:=”^w”, Replace:=”^&”, ReplaceAll:=1, Format:=1
WordBasic.PrintStatusBar “Spaces adjusted by ” + _
CurrentFontSpacing$ + “.”
EndMacro:
End Sub
_________________________________________
READERS WRITE
Claire Meirowitz wrote:
I’m a new subscriber and already love you guys after reading only one issue! Something has been driving me wild for years–to the point that I gave up entirely. In MS Word 2000, my tabs won’t stay where I put them from line to line.
I had received a tip about not lifting the cursor, or maybe always lifting the cursor, but either way, that one doesn’t work. I’ve also used the Tabs button on the Format menu as well as physically moving and/or inserting tabs, but nothing helps for long.
I had understood that if I set the tab stops for the last few lines, that would be OK. BUT, I add to the list periodically and want to keep the tab stops permanently throughout the length of the list. I don’t want to have to re-set the tab stops for each line (that’s what drives me crazy), but continue the same tabs for the length of the document. Is there a way to do that? (I’ve tried by both going into Tabs and setting them there AND by setting the stops at the top.)
I responded:
For tab stops to be set automatically, you have to set the tab stops for the *paragraph style you’re using.* For example, in the document you sent, the items in the list are formatted with the Normal paragraph style. So here’s the procedure:
1. Click Format > Styles and Formatting to display the Task Pane.
2. Click to the right of the Normal style to reveal the little down-arrow.
3. Click the down-arrow.
4. Click Modify.
5. Click Format > Tabs.
6. Set your tabs (type each one into the box and click Set) and their alignment (Left, Decimal, etc.).
7. Click OK.
8. Click OK again.
Now, whenever you hit ENTER to add a new line (paragraph), the tab stops will be applied to that line because they are part of the paragraph style applied to that line.
——————————–
Jenn Morris wrote:
I have 150 Word Documents that were extracted from Quark for Mac. I need to open them in Word for PC and make some changes. One change involves the fonts. In Quark, postscript fonts were used, and the individual fonts for bold, italics and bold italic were used instead of using Quark’s attribute styles. This causes Word for PC to not recognize that the font is styled. However if I highlight some text, the original font name will appear. (For example, “Baskerville Bd BT” appears in the font window.) Manually I do a Search & Replace based on Format and Font name by pasting the above font name into the Find Font line, and then in the Replace field I have the format Font name blank but I apply the Bold style. Eventually all of the text will be converted to Times New Roman, so if I don’t do this I will lose all the bold and italics.
I tried recording a macro to convert all of the fonts used in the original Quark doc, but it doesn’t work.
I also have other macros, along with the font ones, that I am trying to run using MultiMacro on the whole 150 documents to try and automate things. Any help would be greatly appreciated.
I responded:
Word is notorious for not accurately recording macros that find and replace formatting. I run into this all the time, and it drives me nuts. Here’s a macro that should work:
Sub ReplaceAFont()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Font.Name = “Baskerville Bd BT”
Selection.Find.Replacement.Font.Bold = _
True With Selection.Find
.Text = “”
.Replacement.Text = “”
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
If you don’t know how to use such macros, you can learn how here:
http://lists.topica.com/lists/editorium/read/message.html?mid=17069228 55
Actually, you can paste the body of the macro (that is, all but the first and last lines) over and over between the first and last lines, each time modifying these lines as needed:
Selection.Find.Font.Name = “Baskerville Bd BT”
Selection.Find.Replacement.Font.Bold = True
Another example:
Selection.Find.Font.Name = “Courier New”
Selection.Find.Replacement.Font.Italic = True
In addition to Bold and Italic, you can use:
Underline
Shadow
Strikethrough
Superscript
Subscript
And so on.
You can also combine replacement items, using two in the same macro:
Selection.Find.Font.Name = “Courier New”
Selection.Find.Replacement.Font.Bold = True
Selection.Find.Replacement.Font.Italic = True
Of course, you *could* create a separate macro for each kind of formatting–
Sub ReplaceThisFont()
Sub ReplaceSomeOtherFont()
–and then run them all at once with MultiMacro.
Or you could put all the different formats in one macro and use MultiMacro to run that macro on multiple files.
Many thanks to Claire and Jenn.
_________________________________________
RESOURCES
You’ll find more about characters and encodings than you ever wanted to know at Jukka “Yucca” Korpela’s IT and Communication website:
http://www.cs.tut.fi/%7Ejkorpela/chars/index.html
_____________________________________________________
THE FINE PRINT
Editorium Update (ISSN 1534-1283) is published by:
The EDITORIUM, LLC
Microsoft Word Add-Ins for Publishing Professionals
http://www.editorium.com
Copyright © 2008 by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.
You may forward copies of Editorium Update to yourself and others (but not charge for it) and print or store it for your own use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is prohibited. Send reprint requests to reprints [at symbol] 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 assumes the entire risk as to the accuracy and use of this document.
The Editorium is not affiliated with Microsoft Corporation.
_____________________________________________________
HOW TO SUBSCRIBE OR UNSUBSCRIBE
To subscribe, send a blank email message to editorium-subscribe [at symbol] topica.com.
To unsubscribe, send a blank email message to editorium-unsubscribe [at symbol] topica.com.
We do not sell, rent, or give our subscriber list to anyone.
____________________________________________________
You must be logged in to post a comment.