Written by Allen Wyatt (last updated March 3, 2022)
This tip applies to Word 97, 2000, 2002, and 2003
Margaret wrote about a problem she was having performing a find and replace for something in a text box. It seems that Margaret created a merged document, and then noticed that a reference number in a text box was incorrect. She tried to do a search and replace to change all instances of the reference number, but Word would not find and replace it.
In doing some testing, it appears that Word will find information in a text box and replace it just fine, provided that the text box is visible when you actual do the find and replace operation. For instance, if you place some text in a text box, and the same text in the main portion of the document, and then do a find and replace operation for a piece of text that is common to both the document and the text box, then Word will successfully replace all the instances—even those in the text box.
Why wouldn't Word find and replace the reference number in Margaret's situation? There are only a few possibilities. First, the reference number may not really be text. If the reference number was made with an embedded field, then the find and replace will not be reliable. For instance, if the reference number is created with the SEQ field, you can find what is displayed by the field, and you can replace it, but if the fields are updated (which happens when you print), then the "replaced" number reverts back to what the underlying field code tells it to be.
Second, if the reference number is linked in some way to another document (again, using a field), then Word cannot correctly replace the information. This is because the reference number is not in the current document, but in another document linked to the current document. To make the change, you would need to change the source document.
Finally, it could be that the reference number, if it was merged from another data source, contains some non-printable characters that make finding it impossible. For instance, let's say that the reference number you want to find is QR378, but that the text in the merge source includes a non-printing character of some sort between the "R" and the "3". If this is the case, then Word won't find the reference number when you search for QR378. The only way to correct this situation is to clean up the original data source and then run the merge again.
It should be noted that the discussion so far reflects the behavior of Word if you are replacing text using the Find and Replace dialog box. If you are actually doing the searching and replacing in a macro, it is interesting that Word won't find appropriate text matches in text boxes. You can, in fact, use the macro recorder to record a perfectly good Find and Replace operation—that does find and replace text in a text box—and when you later replay the macro, it won't find the information in the text box.
If you are doing searching and replacing in a macro, the following article by Doug Robbins on the Word MVP site explains what is going on:
http://wordmvp.com/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1331) applies to Microsoft Word 97, 2000, 2002, and 2003.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
Need to know how many times a particular word appears in a document? Here's a handy trick that will tell you the count, ...
Discover MoreNeed to get rid of all the comments in your document? You can do so by using the regular Find and Replace feature of Word.
Discover MoreWord allows you to use its searching capabilities to easily find multiple items in a document. What if you want to copy ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2019-05-30 04:53:56
Janice
Aha! I had a 96 page document with a letter on each each with a text box containing a code. The body of the code was 1234 followed by a letter of the alphabet ( I think I got up to 1234rrrr!)
I had to do a second version and add v1 to the number in the text boxes. For days I tried to do a find and replace. A hint below about having all the text boxes in view made me try it, so I reduced the size of the pages to 10% and all the letters fitted within the window – et voila! All my 96 codes now have a v1 added with one find-and-replace command!
Thank you!
2019-01-10 14:02:02
Mrpete
It's worse than that. Word will do a *find* in all text boxes... but after the first find, doing a "replace all" only functions in the one text box.
Apparently it has no find-and-replace in all text boxes. :(
2017-09-26 07:18:38
V.S.Rawat
nothing at all become clear what you are saying and what solution is offerred in this.
sorry dear sir.
2017-06-01 20:06:46
David DeGroot
Or also, if the cursor is in the textbox when she does the Find and Replace, it will only search inside the one textbox. If the cursor is located in a body paragraph, then Find and Replace searches all textboxes.
2016-01-27 11:48:27
I would appreciate your help in the following problem concerning "Find and Replace" feature in Word 2013.
I have got about 300 frames in a Word 2013 document, exactly with the same positioning and frame datas.
I spent hours to try to find those frames, I specified all the possible datas of the frames what to find, but there is no success.
Could anyone send advices how to do this job, and what is the real cause of the situation?
Thank you, regards
Sandor
2015-09-04 07:07:39
Ken Endacott
Find and replace has many peculiarities. If you start with the cursor in the document body, it will search the document body as well as headers and footers and also all textboxes in the document body but not textboxes in headers and footers.
If the cursor is in a header (or footer) it will search just the text in that header (or footer) but not in any textboxes in that header (or footer).
If the cursor is inside a textbox then it will search only the text in that textbox.
Find & Replace run from a macro acts differently. If the cursor is in the document body then only the document body text is searched. This applies even if the macro has been recorded from a manual Find & Replace.
If you want to search every part of a document then a macro is needed to search the text in every StoryRange. Examples are given by Doug Robbins but Doug's macros only search textboxes in the main body not textboxes in headers, footers or other StoryRanges. Additional coding is needed to make sure that evert textbox is searched.
2015-09-03 11:14:38
Bill
I had the same problem as Ralph, it does not search text boxes and selecting all (Ctrl+A) does not help.
2015-06-26 05:53:01
Mihkel Kohava
FIX:
Select all (Ctrl+A) and then use Find and Replace
2015-06-23 12:33:32
Ralph
I had the same problem in Word 2013; searching for instances of a word that was located in text boxes throughout an unmerged document. (I only mention that it was unmerged because in your example the document was merged)
I had inserted text boxes in numerous locations in the document to help clarify the surrounding text. I just wanted to change the word "Project" wherever it occurred in the document with the word "Order".
Word 2013 found some instances of the word "Project" then reported that there were no more occurrences. It had missed more than half of them. I re-started the search from the beginning of the document several times, but to no avail.
I did discover that it would find them if I searched from within each text box, but of course, there were many text boxes, so that defeated the purpose of the search. Eventually, I replaced all the remaining occurrences manually.
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments