Fix a Word for Mac Macro That Replaces Text Only After the Cursor
Question details
Replace all matching text throughout a Word document rather than only after the cursor.

- Product
- Microsoft Word for Mac 2016
- Device & OS
- Mac
- Scenario
- A user runs a recorded VBA find-and-replace macro on a Word document.
- Observed behavior
- The macro changes matching text only after the current cursor position.
Identify the exact text to find and its replacement. Make sure macros are enabled for the document and that you can open the Visual Basic Editor.
Run Find and Replace on the Entire Document Range
Use the document's content range instead of the current selection so the search starts at the beginning of the main document.
The following macro searches the main document body. Headers, footers, and other separate story ranges require additional handling.
In Word, open Tools > Macro > Visual Basic Editor, then open the module containing your macro or insert a new module.
Paste this code into the module and replace the sample strings with your own text: Sub ReplaceThroughoutDocument() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Text = "text to find" .Replacement.Text = "replacement text" .Forward = True .Wrap = wdFindStop .Execute Replace:=wdReplaceAll End With End Sub
Return to Word, open Tools > Macro > Macros, select ReplaceThroughoutDocument, and click Run.
Review the document body to confirm that matches before and after the original cursor position were replaced. Save the file as a macro-enabled Word document (.docm) if you need to keep the macro in it.

Replace Text Manually Without a Macro
Use Word's Find and Replace dialog for a one-time replacement.
Replace Text in Word Documents with WPS Writer
For everyday document editing, WPS Office is a free, lightweight alternative with a familiar interface. Open compatible Word files in WPS Writer and use Find and Replace for straightforward text changes as you transition between office suites.

Frequently Asked Questions
Why does my recorded macro start searching at the cursor?
A recorded macro may use Selection.Find, which operates from the current selection. Use ActiveDocument.Content.Find to search the main document body from its beginning.
Will this macro also replace text in headers and footers?
No. ActiveDocument.Content covers the main document body. To search headers and footers, extend the macro to process the relevant story ranges.
How do I keep the macro in my document?
Use File > Save As and choose the macro-enabled Word document format (.docm). A regular .docx file cannot retain VBA macros.
Can I replace text without using VBA?
Yes. In Word, open Edit > Find > Replace, enter the search and replacement text, and click Replace All.




