Basic concepts
Styles
Tips for understanding styles in Microsoft Word
Why I don't use Custom Table Styles
Layout
Keep a figure on the same page as its caption
Is your image slipping? How to get your images to stand still
Formatting
How the Styles and Formatting Pane works
Why does text change format when I copy it into another document?
Letters are missing in my watermark when I print
How to tell Word to use Australian English or other non-US form of English
Numbering, bullets, headings, outlines
Number headings and figures in Appendixes
Why use Word's built-in heading styles?
Templates
Relationship between documents and templates
Attaching a template to a document
Word and Excel
How to copy a chart from Excel into a Word document
Insert an Excel chart or worksheet into a landscape page
How to create a hyperlink from a Word document to an Excel workbook
Sharing documents
What happens when I send my document to someone else?
How to use the Reviewing Toolbar in Microsoft Word 2002 and Word 2003
Control how a Word document opens from the internet or an intranet
Tools
Resources
Getting help, asking questions
Home
Quick Reference: Copy the macro on this page into your normal.dot file or an add-in file
Word will then default the 'find' text to your selected text.
When you do Edit > Find or Edit > Replace, Word remembers the text you went to 'Find' last time.
This is almost never what I want.
I'd like Word to default the 'Find' text to the text I've selected in the document.
So, I wrote two little macros to do the job.
Just do Edit > Find (or ctrl-f), or Edit > Replace (or ctrl-h) as usual. These macros replace the existing commands, so they kick in automatically.
The text you select will be automatically inserted into the 'Find' text box on the Edit > Find or Edit > Replace dialog boxes, as shown below:

Figure 1: When you use these macros, Word will automatically default the 'Find' text to the text you have selected in the document.
If you select text in a numbered paragraph, copy it, and paste it into the Edit > Find or Edit > Replace dialogs, Word pastes the heading numbering along with the text.
That's very annoying.
Using these macros avoids that problem, because it just pastes the text—not the numbering!
The macros intercept the existing commands as described at:
Intercepting events like Save and Print
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm
If you double-click a word, then Word automatically selects the space after the word, if there is one. Like this:
![]()
Figure 2: When you double-click to select a Word, word automatically selects the trailing space.
These macros trim that trailing space. If you use these macros, the default 'Find' text will be "brown", not "brown ". If you need to search for "brown ", then you'll need to add the extra space.
1. Look at the following for information on how to use the macros:
2. Copy and paste the code of the macros at the end of this page.
Here is the code you need to copy into your file:
Public Sub EditFind()
'Shauna Kelly, www.ShaunaKelly.com, 2006.
'A replacement for the Edit > Find dialog that
'defaults the 'Find' text to the currently selected
'text.
On Error Resume Next
With Dialogs(wdDialogEditFind)
If Not Selection.Start = Selection.End Then
'If the user has selected some text, use that
'text as the default for the Edit > Find
'dialog box.
.Find = Trim(Selection.Text)
End If
'And show the Edit > Find dialog box as normal
.Show
End With
End Sub
Public Sub EditReplace()
'Shauna Kelly, www.ShaunaKelly.com, 2006.
'A replacement for the Edit > Find dialog that
'defaults the 'Find' text to the currently selected
'text.
On Error Resume Next
With Dialogs(wdDialogEditReplace)
If Not Selection.Start = Selection.End Then
'If the user has selected some text, use that
'text as the default for the Edit > Replace
'dialog box
.Find = Trim(Selection.Text)
End If
'And show the Edit > Replace dialog box as normal
.Show
End With
End Sub