Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

Newest Tips

Setting Fraction Bar Overhang Spacing in the Equation Editor

Printing On Both Sides of the Paper

Turning Off AutoComplete for Dates

Ordering Search and Replace

Understanding Auto Line Spacing

Adding Comments to Your Document

Conditional Calculations in Word

 

Transposing Words

Summary: Presents a WordBasic macro that allows you to transpose (switch) two adjacent words. (This tip works with Microsoft Word 6, and Word 95.)

It is not uncommon, when editing a document, to transpose two adjacent words. For instance, you may want the text "often used" to be "used often" instead. Word has no native capability to transpose two words, but you can create a macro that will do the transposition for you. The following WordBasic macro, called Transpose, can be used in Word 6 and Word 95.

Sub MAIN
CharLeft 1, 1
Space$ = ""
If Selection$() = " " Then
   Space$ = " "
   EditClear
End If
WordLeft 1, 1
EditCut
WordRight 1
CharLeft 1, 1
If Selection$() = " " Then
   CharLeft 1
Else
   CharRight 1
EndIf
If Space$ = " " Then Insert Space$
EditPaste
End Sub

To use the macro, all you need to do is position the insertion point between the two words you want to transpose, and then run the macro.

Tip #1 applies to Microsoft Word versions: 6 | 95

Save Time! WordTips has been published weekly since early 1997. Past issues are available in convenient WordTips archives. Have your own enhanced archive of WordTips at your fingertips, available to use at any time!
 
Check out WordTips Archives today!